T-SQL Tutorial

T-SQL @@Error


Return the error number of the Transact-SQL statement executed.

@@Error Syntax

@@ERROR;

@@Error Example

USE model;
GO
UPDATE products
   SET product_type = 'DEDE'
   WHERE product_id = 2;
IF @@ERROR <> 0
   PRINT N'Error: Product type.';
GO

Result
Error: Product type.

See also:
T-SQL Functions -> @@MAX_CONNECTIONS