Listing 7: Code That Incorrectly Resets @@ERROR to 0 /* Update fails with a trappable error. */ UPDATE table1 SET col1 = 'x' WHERE ….. -- @@ERROR = non-zero IF @@ERROR <> 0 -- @@ERROR = non-zero BEGIN -- @@ERROR = 0 SET @err_status = @@ERROR -- Capture the @@ERROR value. ROLLBACK -- Rollback correctly done RETURN @err_status -- Returns 0 (i.e., SUCCESS) END