@@ERROR 变量

如果这样用

 

UPDATE Accounts SET Balance = Balance + @Amount WHERE AccountID = @ID_A
IF (@@ERROR > 0)
    GOTO PROBLEM

 

需要注意:

 

When using the @@ERROR value in Transact-SQL, you must be careful to
check it immediately after each operation. That’s because @@ERROR is reset to 0 when a successful
SQL statement is completed.

 

posted on 2014-04-11 13:44  齐文宣  阅读(190)  评论(0编辑  收藏  举报

导航