enrique_aeo
asked on
sql server 2012 - OFFSET and FETCH clauses
Hi experts, can you gime an store procedure with
We recommend using OFFSET and FETCH clauses instead of the TOP clause to implement a paging solution query and limit the number of rows sent to a client application
We recommend using OFFSET and FETCH clauses instead of the TOP clause to implement a paging solution query and limit the number of rows sent to a client application
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
AS
BEGIN
DECLARE @offset INT
SET @offset = @pageno * @pagesize
SELECT orderid, custid, empid, orderdate
FROM Sales.Orders
ORDER BY orderdate, orderid DESC
OFFSET @offset ROWS FETCH NEXT @pagesize ROWS ONLY;
END