Error Message:

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

This error occurs when you try to specify negative value for the TOP Clause in the select statement.

Simple Example:
[sql]
SELECT TOP(-5) * FROM sys.tables
[/sql]

When the above code is executed error message 127 would occur.

Fix/Resolution:

Update the TOP clause with a positive value.
[sql]
SELECT TOP(5) * FROM sys.tables
[/sql]

In the above code -5 is changed to 5.

Leave a Reply

Your email address will not be published. Required fields are marked *