sql 2005+中的分页实现
Declare @rowsPerPage int
Declare @pageNum int
SET @rowsPerPage = 10
SET @pageNum = 1
With SQLPaging As (
Select Top(@rowsPerPage * @pageNum) ROW_NUMBER() OVER (ORDER BY ORDERID) as resultNum, ORDERID,OPERATOR,REASON FROM Ord_ProcessLog
)
select * from SQLPaging where resultNum > ((@pageNum - 1) * @rowsPerPage);
Declare @rowsPerPage int
Declare @pageNum int
SET @rowsPerPage = 10
SET @pageNum = 1
With SQLPaging As (
Select Top(@rowsPerPage * @pageNum) ROW_NUMBER() OVER (ORDER BY ORDERID) as resultNum, ORDERID,OPERATOR,REASON FROM Ord_ProcessLog
)
select * from SQLPaging where resultNum > ((@pageNum - 1) * @rowsPerPage);