@@ROWCOUNT

Description

Returns the number of rows affected by the last statement. (@@ROWCOUNT in Transact-SQL).

Sample Source Pattern

Syntax

@@ROWCOUNT

Examples

Code:

IN -> SqlServer_01.sql
CREATE TABLE table1
(
    column1 INT
);

CREATE PROCEDURE procedure1
AS
BEGIN
    declare @addCount int = 0;

    INSERT INTO table1 (column1) VALUES (1),(2),(3);
    set @addCount = @addCount + @@ROWCOUNT

    select @addCount
END
;
GO

EXEC procedure1;

Result:

+-+
| |
+-+
|3|
+-+

Known Issues

No issues were found.

No related EWIs.

Last updated