How to Limit Rows in SQL Server (TOP and OFFSET FETCH)

Last updated July 25, 2026 · By the SaturnSQL team

SELECT TOP (n) limits the result to n rows; add ORDER BY to make which rows deterministic. For pagination use OFFSET ... FETCH, which requires an ORDER BY clause.

SELECT TOP (10) *
FROM orders
ORDER BY created_at DESC;

Pagination with OFFSET FETCH

SELECT id, customer_id, amount
FROM orders
ORDER BY id
OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY;

OFFSET still reads and discards the skipped rows, so deep pages get slow. Keyset pagination (WHERE id > @last_seen_id ORDER BY id, with TOP) stays fast at any depth.

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related SQL Server guides

© 2026 Panda Capital Oy Ab. All rights reserved.