开发者

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

开发者 https://www.devze.com 2023-01-26 03:46 出处:网络
I\'m trying to run an osql command from a cmd shell. I need to use a cmd level variable within my 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

精彩评论

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