Returns the number of rows affected by the last statement. It will let you to do a checking on the record you updated.
If the number of rows is more than 2 billion, use ROWCOUNT_BIG.
Example
USE DB2008;
GO
UPDATE User
SET JobTitle = 'Manager'
WHERE UserID = 'u10021'
IF @@ROWCOUNT = 0
PRINT 'Warning: No rows were updated';
GO
Friday, June 4, 2010
SQL @@ROWCOUNT
Posted by Emil Chang at 7:35 PM
Subscribe to:
Post Comments (Atom)
2 comments:
The site SQL Reports has a great SQL tutorial. Highly recommended for people just getting started on SQL selects.
URL 2: http://www.sql-reports.net/2011/03/sql-select-tutorials.html
The site SQL Reports has a great SQL tutorial. Highly recommended for people just getting started on SQL selects.
URL 2: http://www.sql-reports.net/2011/03/sql-select-tutorials.html
Post a Comment