A constant expression was encountered in the ORDER BY list, position %i.

Error Message:
Msg 408, Level 16, State 1, Line 1
A constant expression was encountered in the ORDER BY list, position %i.

Severity level:
16.

Description:
This error message appears, when you try to use a constant expression in the ORDER BY clause.

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 constant expression must be removed.

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

Example(s):
SELECT *
  FROM Northwind.dbo.Orders
 ORDER BY 1-1

Remarks:
While the use of ORDER BY 1 is syntactically valid, the use of the 1-1 expression raises the error.

]]>

Leave a comment

Your email address will not be published.