Search This Blog

Wednesday, July 16, 2014

ROWCOUNT SQL Server Example

SQL Server > Built-In Functions > @@ROWCOUNT

Returns the number of rows affected by the last statement.

Example:

UPDATE Person
SET Age = 31
WHERE Id = 1
IF @@ROWCOUNT = 0
    PRINT 'No rows were updated';