January 8, 2016 at 9:55 am
I have this command running in sql server agent.
osql /U a /S A\B -d AB /P 1 /Q "exec test" /o \\C1122$\D$\test.rpt -w 500
If I want to output the query result in multiple locations, how can I do it using osql.
January 8, 2016 at 10:04 am
You need to run it multiple times or if the output is the same, just copy the file.
January 8, 2016 at 10:15 am
I tried this:
osql /U a /S A\B -d AB /P 1 /Q "exec test" /o \\C1122$\D$\test.rpt -w 500
osql /U a /S A\B -d AB /P 1 /Q "exec test" /o \\C2122$\D$\test.rpt -w 500
But, it writes to only the first location \\C1122$\D$\test.rpt and Not to \\C2122$\D$\test.rpt
January 8, 2016 at 10:22 am
Do you get an error?
Do you run them one by one? Are they in a batch file?
January 8, 2016 at 10:25 am
I am running it from sql agent job, it doesn't give any error.
I am trying to run both commands in single step in a job
January 8, 2016 at 10:32 am
Create a step for each command or create a batch file to run both.
If you send both in a single command, it will ignore the second and all the others.
Wild question: Why are you using osql instead of bcp? You're missing a lot of functionality.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply