A simple example of the @@ERROR variable : Error « Transact SQL « SQL Server / T-SQL






A simple example of the @@ERROR variable


1> -- A simple example of the @@ERROR variable.
2>
3>
4> SELECT 5 / 0
5> SELECT @@ERROR
6>
7> GO
Msg 8134, Level 16, State 1, Server JAVA2S\SQLEXPRESS, Line 4
Divide by zero error encountered.

-----------
       8134

(1 rows affected)
1>
           
       








Related examples in the same category

1.Use @Error
2.Rollback transaction on error
3.Create a Stored Procedure that raises an error