SQL Notebook (logo)

THROW Statement

Throws an error, causing code execution to jump to an enclosing CATCH block. There are no restrictions on what the three parameters must be. They are returned as-is from the ERROR_NUMBER, ERROR_MESSAGE, and ERROR_STATE functions. The parameterless version of THROW causes an error to be raised without changing the existing values of ERROR_NUMBER, ERROR_MESSAGE, and ERROR_STATE. This allows a CATCH block to re-throw an error without changing it.


Syntax for the THROW statement