Top (n) and order by
You SHOULD try to order result sets in the application layer.
Because qualifying statements with ORDER BY are expensive in SQL!
You SHOULD NOT:-
-
Use
SET ROWCOUNT. Prefer theTOP(N)syntax of theSELECTstatement. -
Use
TOPin aSELECTlist without usingORDER BYIt's clear and returns consistent results. -
Use constants in an
ORDER BYclause; It's deprecated and makes code hard to read.
Further reading and information
Avoid using constants in an ORDER BY clause | Redgate (red-gate.com)