RAISERROR In SQL Server
SQL Server has its own error handling mechanism, where @@Error is used to trap the errors and we can get the Error Message for that error. RAISERROR allows developers to produce our own error message. Using RAISERROR , we can throw our own error message while running our Query or Stored procedure. RAISERROR is used to return messages back to applications using the same format as a system error or warning message generated by the SQL Server Database Engine . We can also set our own severity for each and every individual message. To conclude the summary: It allows developers to generate their own messages It returns the same message format that is generated by SQL Server Database Engine We can set our own level of Severity for messages It can be associated with Query and stored procedure General Syntax for using RAISERROR Below is the general syntax for RAISERROR : Hide Copy Code RAISERROR ( { Message ID | Message Text } ...