create proc RowNumber @pageindex int,@pagesize int
AS
BEGINselect * from
(select ROW_NUMBER() OVER(order by CustomerID desc) as px,* from Customers) as a
where a.px between ((@pageindex - 1)* @pagesize + 1) and (@pageindex*@pagesize)END
create proc Offset_Fetch @pageindex int,@pagesize int
AS
BEGINselect * from Customers order by CustomerID desc
offset ((@pageindex - 1) * @pagesize) rows
fetch next @pagesize rows only END