Here is the code in my batch file
set startdate="9/1/2011"
set enddate="10/31/2011"
sqlcmd -Q "exec mysp '%startdate%', '%enddate%'"
I want to execute the c开发者_C百科ommand in SQL Server:
exec mysp '9/1/2011', '10/31/2011'
Well, you haven't exactly told us what's going wrong but I'm guessing the double quotes arond the dates are being included in the command, as per:
C:\Users\Pax> set startdate="9/1/2011"
C:\Users\Pax> echo %startdate%
"9/1/2011"
C:\Users\Pax> set startdate=9/1/2011
C:\Users\Pax> echo %startdate%
9/1/2011
Try removing them.
精彩评论