Wednesday, February 15, 2012

Execute DTS Package from a SP

Hi there
One more question: how do I run a DTS package from within a SP?
The DTS is called dts_LisImport and the server is ADC-SRV1
I tried "execute DTSRun dts_LisImport" and got "Cannot add rows to
sysdepends for the current stored procedure because it depends on the missin
g
object 'DTSRun'. The stored procedure will still be created."
Thanks
PaulIn order to run a package directly from a stored procedure, you need to
either launch DTSRUN using xp_cmdshell or invoke the DTS package using the
sp_OA* procs.
Hope this helps.
Dan Guzman
SQL Server MVP
"Paul in Harrow" <PaulinHarrow@.discussions.microsoft.com> wrote in message
news:F2654667-9E9C-490B-A6CB-F1FAA183312D@.microsoft.com...
> Hi there
> One more question: how do I run a DTS package from within a SP?
> The DTS is called dts_LisImport and the server is ADC-SRV1
> I tried "execute DTSRun dts_LisImport" and got "Cannot add rows to
> sysdepends for the current stored procedure because it depends on the
> missing
> object 'DTSRun'. The stored procedure will still be created."
> Thanks
> Paul|||DTSRun is a command line utility, so you can not execute as if it was
another stored procedure. If you have to run the package from the
stored procedure, then you'll have to use xp_cmdshell. The code might
look like this:
set @.OSCommand = 'DTSRUN -SADC_SRV1 -NLisImport -E'
exec master..xp_cmdshell @.OSCommand
Notice that if users have to run this stored procedure, then you'll
have to grant them permissions on xp_cmdshell. This leads to huge
security problems.
Adi|||Thanks Dan and Adi
I'll have a go at this tomorrow
Paul

No comments:

Post a Comment