Listing 5: Code That Doesn't Test @@ERROR Immediately /* Update fails with a trappable error. */ … UPDATE table1 SET col1 = 'x' WHERE ….. -- @@ERROR = non-zero SET @Msg = 'Table updated successfully' -- @@ERROR = 0 IF @@ERROR = 0 -- @@ERROR = 0 PRINT @Msg -- Message printed ELSE ROLLBACK -- Rollback never happens.