SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


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


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

Author
Message
mikeebertsr
mikeebertsr
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 44
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
ronang
ronang
Valued Member
Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)

Group: General Forum Members
Points: 54 Visits: 136
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search