SQL Server has implemented the
FETCH clauses as part of the
ORDER BY clause, as pointed by the other answers and documented in their documentation.
The SQL standard on the other side, has both of these clauses as independent:
<query expression> ::=
[ <with clause> ] <query expression body>
[ <order by clause> ] [ <result offset clause> ] [ <fetch first clause> ]
If someone wants this feature implemented in full compliance with the standard, they can always make a request to the SQL Server team, through the Connect channel. In fact, MS has commented - in a different request about offset and fetch:
Connect item: SQL Denali: add total rows counter to
SELECT statement - by Alexey Rokhin
Answer: Posted by Microsoft on 24/11/2010 at 11:34
The requirement that
ORDER BY is a restriction in this release. In the ANSI SQL standard (SQL:2011) where the new
OFFSET/FETCH clauses are proposed,
ORDER BY is optional. The restriction in SQL Server has to do with limitation in our parser technology that cannot handle the optional syntax without making
OFFSET a reserved keyword. We may remove it in the future.
Now with respect to ...
Until then, if one wants to use
FETCH without a specific
ORDER BY, a workaround is to add a "do nothing" order by clause. Example:
ORDER BY (SELECT NULL)
OFFSET 0 ROWS
FETCH NEXT 1 ROWS ONLY;