对于sqlserver2000,使用如下语句实现:
select * from
(
select *, couts=(select count(*)+1 from table where id<t1.id) from table t1
) t2
where couts between m and n
对于sqlserver2005,使用如下语句实现:
select * from
(
select *,couts=row_number()+1 over(order by id) from table
) t
where couts between m and n
本文介绍了在SQLServer2000及2005中实现分页查询的方法。对于SQLServer2000,使用子查询结合计数函数来获取指定范围的数据;而在SQLServer2005中,则利用ROW_NUMBER()窗口函数简化了这一过程。

187

被折叠的 条评论
为什么被折叠?



