SELECT TOP
In a SELECT query or table expression, TOP is used with an ORDER BY clause to limit the result to rows that come first in the ORDER BY ordering. You can specify the quantity of rows you want in one of two ways: as an exact number of rows, from TOP (0) to TOP (9223372036854775807) (the largest BIGINT value), or as a percentage of rows, from TOP (0E0) PERCENT to TOP (100E0) PERCENT, using a FLOAT value. SQL Server supports any self-contained expression, not just constants, with TOP.
To make it clear which rows are the “top” rows affected by a TOP query, you must indicate an ordering of the rows. Just as you can’t tell top from bottom unless you know which way is up, you won’t know which rows TOP affects unless you specify an ORDER BY clause. ...
Get Inside Microsoft® SQL Server® 2008: T-SQL Querying now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.