Friday, February 17, 2012

Execute DTS package inside a storedprocedure...

I was wondering if anyone new it you could execute a DTS package inside a stored procedure.

ThanksIn theory, you could run DTSRUN from inside a stored procedure, like so:


CREATE PROCEDURE usp_ImportData AS

DECLARE @.DTSRUNCommand varchar(255)

TRUNCATE TABLE MyTable

SET @.DTSRUNCommand =
'DTSRUN /N ' +
'MyImportPackage /E /S ' +
@.@.SERVERNAME

EXEC master..xp_cmdshell @.DTSRUNCommand

This is using xp_cmdshell, so the SQL user will have to have rights to run it...|||Cool...I will try using it and see if i can get it to work.

Thanks|||It worked awsome...

Thanks

No comments:

Post a Comment