Error Message:
Msg 507, Level 16, State 2, Line 3
Invalid argument for SET ROWCOUNT. Must be a non-null non-negative integer.
Severity level:
16.
Description:
This error message appears, when you try to call SET ROWCOUNT with an invalid argument.
Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.
Resolution:
Error of the Severity Level 16 are generated by the user and can be fixed by the SQL Server user. The invalid argument must be corrected.
Versions:
All versions of SQL Server.
Example(s):
DECLARE @i INT
SET @i = -1
SET ROWCOUNT @i
Remarks:
Interestingly this error is not raised, when you directly use SET ROWCOUNT with a negative number. SET ROWCOUNT -1 raises the error 102.