Using @@ROWCOUNT statement you can get the number of rows/ records affected by query execution. It is best practice that whenever you are doing update or delete on table data and if you know affected row count then you should validate that count against @@ROWCOUNT if it is not matching then transaction should be rolled back.
To get the number of rows affected by the latest query that is executed. The @@ sign indicates that it is the system function.
The @@ROW COUNT variable returns the number of rows read by the last executed statement. If any statement does not return any rows, then value of @@ROWCOUNT variable is set to zero.
@@rowcount is sql function that returns how many rows affected by query execution. we can also use it when insert data into two tables in single procedures based on first table data insertion.
we find the how many rows in table
Only if the person who answered below had some way like @@rowcount to check how many times he is posting the same answer. Isn't it Ironic- he did the same mistake he wanted others to avoid. Posting just for fun, no hard feelings.'@@rowcount is sql function that returns how many rows affected by query execution. we can also use it when insert data into two tables in single procedures based on first table data insertion.'