dbTalk Databases Forums  

Dts package doesn't execute from a stored procedure

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Dts package doesn't execute from a stored procedure in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dan
 
Posts: n/a

Default Dts package doesn't execute from a stored procedure - 09-15-2003 , 11:17 AM






Hi,

I am trying to execute a dts package from a stored procedure. I am
using the sp_OAxxx stored procedures to create, load and execute the
dts package. When I run the stored procedure, no errors occur but the
dts package is not executed. I tried with Windows authentication and
sql Authentication as well. In both cases the result is same ( the
package is not executed).
the dts package runs fine when I run it from Enterprise manager. Is
there something I am doing wrong here? Has anyone come across this
situation before?

Following is the code I am using.
DECLARE @oPKG INT,
@HResult INT,
@ServerParams varchar(100)
SET @ServerParams = 'LoadFromSQLServer(' + @@ServerName +
',,,256,,,,TestPkg)'
-- SET @ServerParams = 'LoadFromSQLServer(' + @@ServerName +
',uid,pwd,0,,,,TestPkg)'

EXEC @HResult = sp_OACreate 'DTS.PACKAGE', @oPKG OUT
IF @HResult = 0
BEGIN
EXEC @HResult = sp_OAMethod @oPKG, @ServerParams, NULL
IF @HResult = 0
BEGIN
EXEC @HResult = sp_OAMethod @oPKG, 'Execute' --Execute the DTS Package
IF @HResult = 0
BEGIN
EXEC @HResult = sp_OADestroy @oPKG --
END
END
END

Thanks in advance
Dan

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Dts package doesn't execute from a stored procedure - 09-16-2003 , 01:20 AM






Did you take a look at

Execute a package from T-SQL
(http://www.sqldts.com/default.aspx?210)
--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Dan" <dthullimelli (AT) yahoo (DOT) com> wrote

Quote:
Hi,

I am trying to execute a dts package from a stored procedure. I am
using the sp_OAxxx stored procedures to create, load and execute the
dts package. When I run the stored procedure, no errors occur but the
dts package is not executed. I tried with Windows authentication and
sql Authentication as well. In both cases the result is same ( the
package is not executed).
the dts package runs fine when I run it from Enterprise manager. Is
there something I am doing wrong here? Has anyone come across this
situation before?

Following is the code I am using.
DECLARE @oPKG INT,
@HResult INT,
@ServerParams varchar(100)
SET @ServerParams = 'LoadFromSQLServer(' + @@ServerName +
',,,256,,,,TestPkg)'
-- SET @ServerParams = 'LoadFromSQLServer(' + @@ServerName +
',uid,pwd,0,,,,TestPkg)'

EXEC @HResult = sp_OACreate 'DTS.PACKAGE', @oPKG OUT
IF @HResult = 0
BEGIN
EXEC @HResult = sp_OAMethod @oPKG, @ServerParams, NULL
IF @HResult = 0
BEGIN
EXEC @HResult = sp_OAMethod @oPKG, 'Execute' --Execute the DTS Package
IF @HResult = 0
BEGIN
EXEC @HResult = sp_OADestroy @oPKG --
END
END
END

Thanks in advance
Dan



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.