A TOP N value may not be negative.

Error Message:
Msg 127, Level 15, State 1, Line 1
A TOP N value may not be negative.

Severity level:
15.

Description:
This error message appears when you try to use a negative value in the TOP clause.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
Error of the Severity level 15 are generated by the user and can be fixed by the SQL Server user. In this case you need to correct the negative value.

Versions:
This error message was introduced with SQL Server 2005.

Example(s):
SELECT TOP(-10) *
  FROM Northwind.dbo.Orders

Remarks:
Because it does not make any sense to use a negative value in the TOP clause, their use is prohibited.

]]>

Leave a comment

Your email address will not be published.