Infomessage event problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a long running stored procedure in which I have placed raiserrors
to track progress in real time. It works great in query analyzer.
I am trying to provide real time progress to the client using the
Infomessage event handler and provide a method that does this. However, the
Infomessage seems to only work AFTER the stored procedure is finished and it
outputs all the raised errors all at once. Is this a bug?

thanks in advance
 
No, it's not a bug. When you call the stored procedure from your
client app, commands are sent over the network in a single call to be
processed on the server, which speeds up execution since all the work
is taking place on the server. When the stored procedure completes, it
sends back any result sets and/or any output parameter values to the
client. The stored procedure would need to be in continuous
communication with the client, employing multiple round trips across
the network for each infomessage. When you think about thousands of
users running a stored procedure all at the same time, then you
realize that if it did work that way that the network would be bogged
down in short order. HTH,

Mary
 
No dude it ain't a bug. It's due to performance reasons that those are
batched together. Your best bet is to rearchitect the stored proc and split
it into smaller tasks in repeated calls - and then show the progress bar
based upon that. Obviously a progress bar solution means multiple database
hits and hence lower performance.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
 
Sorry to contradict everyone on this one :)

I'm not sure I'd call it strictly a "bug", let's just say it's "undesirable
behavior" :)

I agree that for certain scenarios where you need to report progress this
would be a nice thing to have. In the next version of the .NET Framework
you'll have the option to get InfoMessage events as the server sends them to
the client, instead of all of them at the end.

Unfortunately there is no work-around for the current versions.

--
Pablo Castro
Program Manager - ADO.NET Team
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top