Quantcast
Channel: SQL Errors – SQLSERVERLEARNER
Viewing all articles
Browse latest Browse all 74

A TOP N value may not be negative

$
0
0

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:

SELECT TOP(-5) * FROM sys.tables

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

Fix/Resolution:

Update the TOP clause with a positive value.

SELECT TOP(5) * FROM sys.tables

In the above code -5 is changed to 5.


Viewing all articles
Browse latest Browse all 74

Trending Articles