ORDER BY ... OFFSET
skips the first N ordered rows
What changes
- Input
- ordered rows
- Output or change
- rows after skipping N
Syntax at a glance
ORDER BY order_by_expression OFFSET { integer_constant | offset_row_count_expression } { ROW | ROWS }
Work example
A result page needs ORDER BY ... OFFSET with a stable key order before rows are skipped or returned.
Sort by a unique key as the final tie-breaker. Request adjacent pages and check that no row is skipped or repeated.
Check your work ORDER BY ... OFFSET. The result order for ORDER BY ... OFFSET is repeatable and page boundaries have no gaps or duplicates.
Open Microsoft Learn for full syntax, permissions, and details for your version.