After each Transact-SQL statement, the server sets the value of this variable to the total number of records affected by it. It can be used to verify the success of selected operations:
SQL Server sets the value of the @@rowcount variable after each T-SQL statement to the total number of records affected by the statement. The @@rowcount variable is usually used to verify success of a certain query. Here is a small example:
SELECT ID, StudentName, StudentSurname, StudentAgeINTO AugustStudentsFROM CurrentStudentsWHERE CourseFinishDate < '2016-09-01'IF @@rowcount = 0PRINT "No rows were copied!"