Listing 2: Common but Incorrect Method of Saving System Functions DECLARE @err_status int, @row_count int UPDATE table1 SET col1 = 'ab' /* Use single statement to store system functions. */ SELECT @err_status = @@ERROR -- This sets @@ROWCOUNT to 1. SELECT @row_count = @@ROWCOUNT -- @row_count will always be 1. IF @err_status <> 0 BEGIN -- Take appropriate action. END IF @row_count = n -- Test may fail because @row_count will be 1. BEGIN -- Take suitable action. END