Use AdventureWorks;
Create Proc dbo.procSalesGetPageOfData
(
@PageSize as int,
@PageNo int
)
As
Begin
With ctePaging
As
(
Select
Top(@PageSize * @PageNo) Row_number()
Over (Order by SalesOrderID, SalesOrderDetailID) as SeqNo,
OrderQty, UnitPrice, LineTotal, ModifiedDate
From Sales.SalesOrderDetail
)
Select * from ctePaging
where SeqNo > ((@PageNo - 1) * @PageSize)
End
go
-- exec dbo.procSalesGetPageOfData 10,351
No comments :
Post a Comment