Thursday, March 21, 2019

Using OFFSET in T-SQL pagination.

SELECT *
   FROM dbo.People
   ORDER BY Name
   OFFSET 200 ROWS
   FETCH NEXT 10 ROWS ONLY

 
 

There are variants of this wherein NEXT is replaced by FIRST and/or the ONLY keyword is left off, but I do not recommend those.

No comments:

Post a Comment