execute a ssis package using xp_cmdshell

  • Hi All ,

    I have a problem executing a ssis package using the xp_cmdshell command. I built a string with all parameters for ssis and passed the string to the cmd shell as argument. Here is a code sample.

    Please advice me on this issue.

    Code

    ----------------------------------------------------------------------------------

    declare @cmd nvarchar(4000)

    declare @final_str varchar(8000)

    declare @returncode varchar(100)

    set @cmd='''dtexec /sq "Maintenance Plans"\MarketOnce\PMTA\pmta /set \package.variables[User::FilePath].Value;\\svrrbidevdb01\c$\Services\me\marketonce\pmta_accounting\pending\ /set \package.variables[User::FileName].Value;acct-2008-11-07-0036.csv /set \package.variables[User::JobIDValue].Value;89'''

    select @cmd

    set @final_str = cast(@cmd as varchar(8000))

    exec @returncode = master..xp_cmdshell @final_str

    select @returncode

    Error Description:

    ---------------------------------------------------------------------------------

    ''dtexec' is not recognized as an internal or external command,operable program or batch file.

    Thank You,

    Arun Vempati

  • arun (11/11/2008)


    Hi All ,

    I have a problem executing a ssis package using the xp_cmdshell command. I built a string with all parameters for ssis and passed the string to the cmd shell as argument. Here is a code sample.

    Please advice me on this issue.

    Code

    ----------------------------------------------------------------------------------

    declare @cmd nvarchar(4000)

    declare @final_str varchar(8000)

    declare @returncode varchar(100)

    set @cmd='''dtexec /sq "Maintenance Plans"\MarketOnce\PMTA\pmta /set \package.variables[User::FilePath].Value;\\svrrbidevdb01\c$\Services\me\marketonce\pmta_accounting\pending\ /set \package.variables[User::FileName].Value;acct-2008-11-07-0036.csv /set \package.variables[User::JobIDValue].Value;89'''

    select @cmd

    set @final_str = cast(@cmd as varchar(8000))

    exec @returncode = master..xp_cmdshell @final_str

    select @returncode

    Error Description:

    ---------------------------------------------------------------------------------

    ''dtexec' is not recognized as an internal or external command,operable program or batch file.

    Thank You,

    Arun Vempati

    Arun,

    mention the "dtexec.exe" file complete path (eg: C:\Program Files\Microsoft SQL Server\90\Tools\Binn\dtexec.exe).

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply