Listing 1: Code That Correctly Saves 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, @row_count = @@ROWCOUNT IF @err_status <> 0 BEGIN -- Take appropriate action. END IF @row_count = n -- Whatever value is appropriate. BEGIN -- Take suitable action. END