T-SQL Tutorial

T-SQL Error_severity()


Return the code number of the error that use the CATCH block of a TRY ... CATCH.

Error_severity() Syntax

ERROR_SEVERITY();

Error_severity() Example

USE model;
GO
BEGIN TRY
   SELECT 26/0;
END TRY
BEGIN CATCH
   SELECT ERROR_SEVERITY() AS Error_Severity;
END CATCH;
GO

Error_Severity
16

See also:
T-SQL Functions -> ERROR_NUMBER()