Alaa
Alaa

Reputation: 575

user defined exceptions

Are there user-defined exceptions in tsql ?

Upvotes: 1

Views: 1748

Answers (2)

marc_s
marc_s

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

Neil Knight
Neil Knight

Reputation: 48597

RAISERROR

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

Related Questions