October 8, 2008 at 3:31 am
I have a job that runs a SSIS package using this command line:
"C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\DTExec.exe" /DTS "\MSDB\StratificaGiacenzaDaCSV" /SERVER "DV-ERP" /SET \package.variables[strRollUpDate].Value;"2008/09/28 23:00" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V
When I launch it manually, it works fine.
Now I create a Stored Procedure with this line:
EXEC master..xp_cmdshell '"C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\DTExec.exe" /DTS "\MSDB\StratificaGiacenzaDaCSV" /SERVER "DV-ERP" /SET \package.variables[strRollUpDate].Value;"2008/09/28 23:00" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V'
When I launch that stored procedure I get this error:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
NULL
I know it's a quoting problem, but I can't resolve the issue...
Any help?
Thanks!
October 8, 2008 at 10:21 am
I solved the issue adding a " at the beginning of the string:
EXEC master..xp_cmdshell '""C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\DTExec.exe" /DTS "\MSDB\StratificaGiacenzaDaCSV" /SERVER "DV-ERP" /SET \package.variables[strRollUpDate].Value;"2008/09/30 23:00" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V'
and this works great in a query window of the Management Studio.
Now the problem is that if I store the string in a VARCHAR variable (@cmd) in a stored procedure, and then I try to launch this command (even in the stored procedure):
EXEC master..xp_cmdshell @cmd
I get this error:
Microsoft (R) SQL Server Execute Package Utility
Version 9.00.3042.00 for 32-bit
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
NULL
Argument ""\package.variables[strRollUpDate].Value;"" for option "set" is not valid.
NULL
even if the string stored in @cmd is the same of the "manual" string of the query window...
I can't understand why I get the error...
Any suggestion?
Thanks
October 10, 2008 at 4:13 am
I got the solution empirically... The package goes on with this string stored in the @cmd variable:
C:\Progra~2\Micros~2\90\DTS\Binn\DTExec.exe /DTS \MSDB\StratificaGiacenzaDaCSV /SERVER DV-ERP /SET \package.variables[strRollUpDate].Value"; 2008/10/01 23:00" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V
I really can't understand why the double quotes work in this way...
November 10, 2010 at 6:45 am
lucazav (10/10/2008)
I got the solution empirically... The package goes on with this string stored in the @cmd variable:
C:\Progra~2\Micros~2\90\DTS\Binn\DTExec.exe /DTS \MSDB\StratificaGiacenzaDaCSV /SERVER DV-ERP /SET \package.variables[strRollUpDate].Value"; 2008/10/01 23:00" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V
I really can't understand why the double quotes work in this way...
Hi,
It works ...
EXEC xp_cmdshell 'C:\"Program Files"\"Microsoft SQL Server"\100\DTS\Binn\DTExec.exe .............'
November 11, 2010 at 1:42 am
sudhakara (11/10/2010)
lucazav (10/10/2008)
I got the solution empirically... The package goes on with this string stored in the @cmd variable:
C:\Progra~2\Micros~2\90\DTS\Binn\DTExec.exe /DTS \MSDB\StratificaGiacenzaDaCSV /SERVER DV-ERP /SET \package.variables[strRollUpDate].Value"; 2008/10/01 23:00" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V
I really can't understand why the double quotes work in this way...
Hi,
It works ...
EXEC xp_cmdshell 'C:\"Program Files"\"Microsoft SQL Server"\100\DTS\Binn\DTExec.exe .............'
I think you have too many quotes..
EXEC xp_cmdshell '"C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTExec.exe" .............'
should handle it nicely..
CEWII
October 24, 2015 at 8:49 am
hello,
can you tell me yf this works when you put this code into ASP page and run from remote location?
This is exactly what i need to run a SSIS job from and ASP page...aSSIS job that creates tables from and external excel file...
thank you.
October 24, 2015 at 7:32 pm
jorge_gomes98 (10/24/2015)
hello,can you tell me yf this works when you put this code into ASP page and run from remote location?
This is exactly what i need to run a SSIS job from and ASP page...aSSIS job that creates tables from and external excel file...
thank you.
The Double Quotes are necessary because there are spaces in the path to the EXE.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply