开发者

How can I use a cmd variable in an osql command?

I'm trying to run an osql command from a cmd shell. I need to use a cmd level variable within my osql command.

For example, I have a variable %mydate%, and I want to pass it in as the value for th开发者_StackOverflow社区e @start_date parameter in the following osql call.

osql -Sdb -Uautosys -Pdata_load -ddms -Q"EXEC dbo.sp @start_time = '' "

How can I do this?

TIA!


Have you tried this?

osql -Sdb -Uautosys -Pdata_load -ddms -Q"EXEC dbo.sp @start_time = '%mydate%' "

dos substitution happens quite early, so osql shouldn't see the actual string %mydate%

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜