Code Snippet posted by:
Akiii | Posted on: 7/9/2012 | Category:
SQL Server Codes | Views: 407 | Status:
[Member] |
Points: 40
|
Alert Moderator
@@ROWCOUNT returns the number of rows affected by the last statement. For example :-
UPDATE table_name
SET first_name = 'Dotnetfunda'
WHERE id = 1
IF @@ROWCOUNT = 0
print 'No rows were updated';
In the above example, table is updated where
id = 1 . If there is no row affected then it will print a message.
Thanks and Regards
Akiii