I would like to implement paging using SQL Server limit and offset as shown below. My question is, will SQL Server guerantee the correct data page when data is ordered by non-unique column?
SELECT * FROM TableName
ORDER BY NonUniqueColumn
OFFSET 10 ROWS
FETCH NEXT 20 ROWS ONLY
OPTION (recompile)
SELECT * FROM TableName
ORDER BY NonUniqueColumn
OFFSET 20 ROWS
FETCH NEXT 10 ROWS ONLY
OPTION (recompile)
These two selects overlap. Will the second select (second page) contain the last ten rows from the first select?