SQL2005 大数据量检索的分页
程序员文章站
2022-05-10 23:21:59
@startindex为当前页起始序号,@endindex为当前页结束记录序号,可以直接作为参数输入,也可以通过输入pagesize和pageindex计算得出 复制代码...
@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