The topic describes the DF002 T-SQL code analysis rule.
BEST PRACTICE
Order by with constant.
In the ORDER BY clauses, constants are used to specify the position of columns in the SELECT list.
Avoid specifying integers in the ORDER BY clause to represent the positions of columns in the select list. For example, while a statement such as SELECT ProductID, Name FROM Production.Production ORDER BY 2 is technically valid, but it can be confusing for others to understand compared to specifying the actual column name. In addition, any changes to the select list, such as rearranging column order or adding new columns, particularly before the existing columns in the select list, would require modifying the ORDER BY clause to prevent unexpected results.
SELECT FirstName, LastName
FROM Sales.Customers
ORDER BY 1;
SELECT FirstName, LastName
FROM Sales.Customers
ORDER BY FirstName;