January 28, 2010 at 1:54 pm
I have a ssis package that calls a SQL Script in which i have a bunch of sql queries which runs for a long time. How can i capture log (either success or failure) of all those quries into a text file and export to a location each time i exec this job.
January 28, 2010 at 2:01 pm
I would add that "feature" to the SQL script (so you can run and test it separately).
You could either store the result of each query in a temp table or a variable and use bcp to export it as a file.
January 28, 2010 at 2:15 pm
Actually i am not trying to capture the result but the message's in the result pane
January 28, 2010 at 2:32 pm
Off the top of my head, one way to get the message output would be to use osql command line utility where you can the SQL script as an input file and specify an output file. Not sure if it will help you but you can try. If you have select statements, then that might get output as well.
Something like this
osql -E iC:\s.sql > output.txt
or
osql -E iC:\s.sql -oC:\Output.txt
where s.sql is your SQL script, -E is for trusted connection ( you could use -U and -P for sql connection), -i and -o are options to specify input and output file with the full path.
Venk
January 28, 2010 at 2:35 pm
Another question is, what are you looking for in the output? If you just want rows affected and such, Lutz suggestion will probably work better.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply