Reputation: 575
Are there user-defined exceptions in tsql ?
Upvotes: 1
Views: 1748
Reputation: 755531
You can define your own, custom error messages and use those when calling RAISERROR
SQL Server doesn't really have a concept of "exceptions" per se - but you can raise your own customer errors as shown above.
Upvotes: 1
Reputation: 48597
Generates an error message and initiates error processing for the session. RAISERROR can either reference a user-defined message stored in the sys.messages catalog view or build a message dynamically. The message is returned as a server error message to the calling application or to an associated CATCH block of a TRY…CATCH construct.
from MSDN
Upvotes: 2