Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

raiserror with Nowait not working as expected 1

Status
Not open for further replies.

baboudi

Technical User
Oct 18, 2007
34
GB
Hi all,

I am using raiserror with nowait for the first time but I am not having the expected behaviour.

i.e. if I run the following, I should have the first message immediatley and the second one after 5 secs, but both messages are appearing at the end of the procedure run (as if NOwait is being ignored)

RAISERROR ('DELAY 1 HAS ENDED', 10,1) WITH NOWAIT

WAITFOR DELAY '00:00:05.00'

RAISERROR ('DELAY 2 HAS ENDED', 10,1) WITH NOWAIT


I tried this on different SQL Servers (2005/2008) with the same behaviour.

Am I missing something obvious?

Thanks a lot
Benoit
 
Apologizes if this is a stupid question, but havent figured this one yet, and all my research showed that I should get a message immediately when the nowait is used.

any comments/pointers very welcome
 
How to say... When executing the block of lines in the management studio, look into the "Messages" tab _immediately_ (it requires a user click on the "Messages" tab otherwise it is defaulted to "Results" tab), the first msg_str does show up immediately and then waiting till the second msg_str.

If one stays on the "Results" tab till the end of the execution, it creates an illusion of both msg_str appear simulataneously after the 5 sec delay.

It seems the behaviour is following the description of the documentation.
 
thanks tsuji and markros.

Thats was the mistake I was doing...looking under results instead of messages!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top