Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 RAISERROR WITH NOWAIT vs RAISERROR + RETURN

Author  Topic 

vermorel
Starting Member

26 Posts

Posted - 2006-12-19 : 08:44:15
I would like to know if there was any semantic differences between the two following statements?

RAISERROR('Invalid argument.',11,1);
RETURN;

or simply

RAISERROR('Invalid argument.',11,1) WITH NOWAIT;

It seems that both statements interrupt the current transaction.

Does anyone has an idea on the subject?

Thanks in advance,
Joannes

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-19 : 08:51:46
In first scenario, control is returned imeediately to the client aborting any further execution while in second case even though error message is immediately sent to the client, execution continues further.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

vermorel
Starting Member

26 Posts

Posted - 2006-12-19 : 09:37:03
Thanks,
Joannes
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-12-19 : 09:42:32
or call the raiserror with severity of 18 and the execution stops automatically without the ned for return.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-19 : 22:21:45
www.sommarskog.se/error-handling-I.html
www.sommarskog.se/error-handling-II.html


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -