T-SQL Tutorial

T-SQL @@Rowcount


The rowcount function is a system function that returns the number of rows affected by the last statement.

@@Rowcount Syntax

@@ROWCOUNT;



@@Rowcount Example

USE model;
GO
UPDATE students
SET section = N'History'
WHERE id = 7
IF @@ROWCOUNT > 0
PRINT 'Updated'
GO

Result
Updated

See also:
T-SQL Functions -> @@MAX_CONNECTIONS