@@error is a sql server variable which returns error number generated by last query.Example:-if u run a query and this return error and can't execute.so in long procedure it is much important to rollback transaction .Declare @@error_return as intupdate table_1 set name='Ais' where employeeid='HOM0044' and lastname like 'Singh%'set @error_return=@@errorif @error_return>0---rollback tranelse commit tran
Dear Raj Kumar @@Error is System Variable in Sql Server
Heloo Friend!
This is sql server keyword to represent the error occures during any excution of sql statement and it has 0 for no error ,it has various number for various type of errors
Thank you!
It is your pl/sql returning variable that returns current line error details.
It is an returning variable in pl/sql that returns the error for the current line.
@@ERROR Returns the error number for the last Transact-SQL statement executed.When SQL Serversuccessfully completes the execution of a Transact-SQL statement, @@ERROR is return 0 if the statement executed successfully. If an error occurs, an error message is returned. @@ERROR returns the number of the error message until another Transact-SQL statement is executed. You can view the text associated with an @@ERROR error number in the sysmessages system table.