Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
cmdシェルからosqlコマンドを実行しようとしています。osqlコマンド内でcmdレベル変数を使用する必要があります。
たとえば、変数%mydate%があり、次のosql呼び出しで@start_dateパラメーターの値としてそれを渡したいと思います。
osql -Sdb -Uautosys -Pdata_load -ddms -Q"EXEC dbo.sp @start_time = '' "
これどうやってするの?
TIA!
これを試しましたか?
osql -Sdb -Uautosys -Pdata_load -ddms -Q"EXEC dbo.sp @start_time = '%mydate%' "
dos置換はかなり早い段階で行われるため、osqlは実際の文字列を認識しないはずです。%mydate%
%mydate%