ruwnumber自定义分页
时间:2011-02-18 来源:happygx
declare @pageIndex int
declare @startRowIndex int
declare @maximumRows int
set @pageIndex=5
set @startRowIndex=0
set @maximumRows=1000
set @startRowIndex=(@pageIndex-1)*@maximumRows+1
select ProductID,ProductName,AuthorNames,ManufacturerName,RowRank
from (
select ProductID,ProductName,AuthorNames,ManufacturerName,row_number() over(order by ProductID) as RowRank
from Products
) as ProductsWithRowNumbers
where RowRank >= @startRowIndex
and RowRank < (@startRowIndex + @maximumRows)
相关阅读 更多 +