Any way to get output in Query Analyzer during batch execution?

  • I know this is probably a worn out question, but is there any way to send output to the user while a batch or stored proc is running?  If I use GO, then all of the variables go out of scope.  This particular stored procedure starts a trace that can run for days and all the while, the user sees nothing except 'Executing Query Batch...'  Seems kind of lame.  Do I have to create an executable program to wrap the stored proc call in, just so I can tell the user when it started, what the runtime parameters are, which step it's currently executing, etc?

    Thanks in advance,

    Mike

  • I have understood two things from your question.

    1. Since the stored procedure takes much time, the user doesn't know at what particular point the procedure is currently moving on.

    2. To create a executable program to give the output of the stored procedure.

    For question 1:

    Inside the stored procedure give a raiseerror statment rather than the print statement. Because raiseerror will not buffer the output and as long as the statment reaches it will throw the output.

    For question 2:

    You can write a batch file to redirect the output to a file by the following way.

    osql /U alma /P /i titles.qry /o titles.res
    P.S : BOL osql utility /o redirects the output to a file.
    Thanks,
    Ganesh

     

     

     

  • Thank you!  I hadn't thought of RAISEERROR, that should do the trick!

     

    Mike

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply