...

/

Raising and Throwing Errors

Raising and Throwing Errors

Learn to generate custom error messages.

There are times when we know that our stored procedures or functions might generate an error. In these cases, we can raise custom errors that have readable messages.

The RAISERROR() function

We can intentionally raise an error in our query using the RAISERROR() function. It has this syntax:

RAISERROR([Message], [Severity], [State])
...