Is there a system stored procedure that you can pass the name of a DTS package to as a parameter that will execute that DTS package? If so, what SP is it?
Here is another method without the use of xp_cmdshell.
CREATE PROC spExecuteDTS
@Server varchar(255),
@PkgName varchar(255), -- Package Name (Defaults to most recent version)
@ServerPWD varchar(255) = Null, -- Server Password if using SQL Security to load Package (UID is SUSER_NAME())
@IntSecurity bit = 0, -- 0 = SQL Server Security, 1 = Integrated Security
@PkgPWD varchar(255) = '' -- Package Password
AS
SET NOCOUNT ON
/*
Return Values
- 0 Successfull execution of Package
- 1 OLE Error
- 9 Failure of Package
*/
DECLARE @hr int, @ret int, @oPKG int, @Cmd varchar(1000)
-- Create a Pkg Object
EXEC @hr = sp_OACreate 'DTS.Package', @oPKG OUTPUT
IF @hr <> 0
BEGIN
PRINT '*** Create Package object failed'
EXEC sp_displayoaerrorinfo @oPKG, @hr
RETURN 1
END
with reference to tb's comment "How (if possible) would you set Global Variables of the DTS Package within the stored proc?"
Is this possible? To get an sp to pass/set a global variable in a dts package?
As I need my package to fail if a certain criteria is met, I have my if/else statement in my sp and would like it to return/set a varable and maybe use a little bit of activex code to fail the package
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.