April 28, 2009 at 1:01 pm
Hi all,
I'm using raiserror inside my proc. If a particular condition arises and I want the proc to abort once I do this raiserror. I was under the impression that any severity between 11 and 18 would cause the proc to abort - but this doesn't seem to be the case, my proc continues to execute after the raiserror. The only way I was able to get this to work was to to do a return stmt after the raiserror.
Is my assumption about severities between 11 and 18 correct or do you have to do a return after a raiserror?
Thanks in advance for any assistance.
Regards,
Mike
April 28, 2009 at 1:03 pm
It depends on the proc. Some statements can be continued after an error, some can't. In SQL 2005 (or 2008), your best bet is to use Try...Catch blocks. In 2000, put a Return after the Raiserror.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 28, 2009 at 1:15 pm
Thanks for the quick reply. I'm in 2005 - I'll give the TRY/CATCH a go.
-Mike
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply