如果这样用
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.
原文:http://www.cnblogs.com/lthxk-yl/p/3658567.html