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%
精彩评论