Return the state number of the error that use the CATCH block of a TRY ... CATCH.
Error_state() Syntax
ERROR_STATE();
Error_state() Example
USE model;
GO
BEGIN TRY
SELECT 16/0;
END TRY
BEGIN CATCH
SELECT ERROR_STATE() AS Error_State;
END CATCH;
GO
Error_State |
---|
1 |
See also:
T-SQL Functions ->
ERROR_PROCEDURE()