Listing 8: More 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 ROLLBACK -- Rollback executed correctly RETURN @@ERROR -- Returns 0 (i.e. SUCCESS). Calling code is expecting a non-zero value for failure. END