开发者

concatenation in windows batch file

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜