SQL2005 大数据量检索的分页
编程学习 2021-07-05 16:33www.dzhlxh.cn编程入门
仅列出实例SQL,其他的请大家自己完成吧
@StartIndex为当前页起始序号,@EndIndex为当前页结束记录序号,可以直接作为参数输入,也可以通过输入PageSize和PageIndex计算得出
select * from
(
select *,row_number() over(order by OrderColumn) as orderindex from TableName
) as a
where a.orderindex between @StartIndex and @EndIndex
代码如下:
select * from
(
select *,row_number() over(order by OrderColumn) as orderindex from TableName
) as a
where a.orderindex between @StartIndex and @EndIndex