DTEXEC command works from command prompt, does not work from xp_cmdshell

  • Hello. This is my first time asking a question here. I hope I give enough detail to explain the problem.

    I have a DTEXEC command that is built on the fly by a stored proc. Here it is:

    dtexec /F \\lislefs1\filearchives\HSBSSouth\Datawarehouse\SSIS\SSIS_HLX_Extract\SSIS_HLX_Extract.dtsx /CONFIGFILE c:\users\mebert\default.dtsconfig /SET "\package.Variables[User::Source].Properties[Value]";"\"SELECT top 9 line_text line_text FROM ##HLXElg_extract154""

    When I paste this command into a DOS command window and run it, it runs perfectly. When I try to run it from a query window, it fails with this error:

    Msg 170, Level 15, State 1, Line 1

    Line 1: Incorrect syntax near '/'.

    Msg 1038, Level 15, State 3, Line 1

    Cannot use empty object or column names. Use a single space if necessary.

    Msg 170, Level 15, State 1, Line 1

    Line 1: Incorrect syntax near ''.

    This happens when I run the dtexec directly from a query window and also when I run it from xp_cmdshell.

    I thought about putting the SSIS package into a SQL Server Agent job and calling the job instead. I'm pretty sure that would work, but I can't allow the proc to continue processing until the package finishes.

    Please let me know if you need any more info. Any help would be appreciated.

    Thanks

    Mike

  • Hi Mike

    What version of SQL Server are you using?

    What I would do in this situation is actually look at the string being passed to the cmdshell by adding a select after you have created the DTEXEC command to show the exact string you are asking SQL to execute. I don't think you are passing the command in the following format

    EXEC xp_cmdshell 'DTEXEC Command'.

    First eliminate the syntax as a problem, then we can begin to work on the rest of the possible issues.

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

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