2020-06-10 21:35:43

C# Linq

int pageSize = 5;
var result = Employees.Skip((pageNumber - 1) * pageSize).Take(pageSize);

SQL Server 2012

SELECT ...
FROM ...
WHERE ...
ORDER BY                 -- Must have
OFFSET     10 ROWS       -- skip 10 rows
FETCH NEXT 10 ROWS ONLY; -- take 10 rows

Or use default ORDER BY:

SELECT  ...
FROM ...
WHERE ...
ORDER BY CURRENT_TIMESTAMP
OFFSET     10 ROWS       -- skip 10 rows
FETCH NEXT 10 ROWS ONLY; -- take 10 rows
Copyright © 2024 delaney. All rights reserved.