Raj Kumar M
What is @@ERROR?
By Raj Kumar M in SQL Server on Jan 29 2010
  • Aishwary Singh
    Oct, 2010 27

    @@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  int
    update table_1 set name='Ais' where employeeid='HOM0044' and lastname like 'Singh%'
    set  @error_return=@@error
    if @error_return>0
    ---rollback tran
    else commit tran

    • 0
  • Hirdayanand Mishra
    Apr, 2010 7

    Dear Raj Kumar
       @@Error is System Variable in Sql Server


    • 0
  • Ashish Dwivedi
    Mar, 2010 18

    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!

    • 0
  • Amit Choudhary
    Mar, 2010 6

    It is your pl/sql returning variable that returns current line error details.

    • 0
  • Amit Choudhary
    Mar, 2010 6

    It is an returning variable in pl/sql that returns the error for the current line.

    • 0
  • Hirendra Sisodiya
    Feb, 2010 9

    @@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.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS