SA0018 : Support for constants in ORDER BY clause have been deprecated | ![]() |
The topic describes the SA0018 analysis rule.
Support for constants in ORDER BY clause have been deprecated
This rule checks for use of ORDER BY clause specifying constants as sort columns. Support for this syntax has been deprecated.
The rule has a Batch scope and is applied only on the SQL script.
Name | Description | Default Value |
---|---|---|
IgnoreOredrByInOverClause | Parameter specifies if to ignore order by a constant when it is used inside an OVER clause. | yes |
The rule does not need Analysis Context or SQL Connection.
Design Rules, Deprecated Features
There is no additional info for this rule.
1CREATE PROCEDURE HumanResources.uspGetAllEmployees 2AS 3SET NOCOUNT ON; 4 5SELECT LastName, 6 FirstName, 7 JobTitle, 8 Department 9FROM HumanResources.vEmployeeDepartment 10ORDER BY 2 -- numeric constant is allowed 11 12SELECT au_id 13FROM dbo.authors 14ORDER BY 'a', -- string constants are deprecated 15 NULL -- NULL is deprecated 16 17 18SELECT au_id 19FROM dbo.authors 20ORDER BY 'a', -- string constants are deprecated and NULL-s are deprecated, 21 NULL -- but will be ignored because of the rule suppression mark here -> IGNORE:SA0018
Message | Line | Column | |
---|---|---|---|
1 | SA0018 : Support for constants in ORDER BY clause have been deprecated. | 14 | 9 |
2 | SA0018 : Support for constants in ORDER BY clause have been deprecated. | 15 | 9 |
© Ubitsoft Ltd. All Rights Reserved.