sqlserver 常用分页函数
sqlserver2012之前
测试每页都是取5条数据
ROW_NUMBER() OVER()方式(over函数必须有)
select * from ( select *, ROW_NUMBER() OVER(Order by ID ) AS RowId from 表 ) as b where RowId between 1 and 5;
sqlserver2012之后
offset start fetch next page rows only
select * from 表 order by ID offset 0 rows fetch next 5 rows only;