Query Log

  • 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.

  • 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.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Actually i am not trying to capture the result but the message's in the result pane

  • 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

  • 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