ERROR_MESSAGE Function

Returns the error message set by the last THROW statement.

Syntax

ERROR_MESSAGE()

Return Value

The last error message string.

Example

-- Prints "Message".
BEGIN TRY
THROW 'Message';
END TRY
BEGIN CATCH
PRINT ERROR_MESSAGE();
END CATCH;

See Also