RAISERROR and Exceptions

RAISERROR with severity level below 10 are not catched by ADO framework. To fix it simply raise severity level to 10 or above or you can instead use THROW statement which has severity level of 16 by default and will always be catched by the ADO framework (C#).

RAISERROR(‘Your Error Message’, ‘Severity Level’, ‘State Level’)

Set Severity Level to 16
Set State Level to 1

Note that RAISERROR does not stop execution. It is recommend to use THROW statement inst5ead to raise error and stop execution.

Does RAISERROR cause Transaction ROLLBACK

This entry was posted in Tutorials/Tips and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s