The topic describes the DF033 T-SQL code analysis rule.
BEST PRACTICE
The SELECT TOP statement is used without the ORDER BY clause.
It is recommended that you always use an ORDER BY clause in SELECT TOP statements to specify the order in which the rows are returned. This helps ensure that the result set is predictable and consistent.
If the ORDER BY clause is not specified, the order of returned data will depend on different factors. These include the order and type of table joins (nested loop, hash join, merge join), whether indexes are used for data selection, whether parallelisation is used, whether intermediate data is stored in tempdb, etc.
SELECT TOP (100) *
FROM dbo.DemoTable
SELECT TOP (100) *
FROM dbo.DemoTable
ORDER BY FirstName ASC