随便记一下
直接利用row_number() over(order by id)
函数计算出行数,选定相应行数返回即可,不过该关键字只有在SQL server 2005版本以上才有。
set statistics time on; -- 分页查询(通用型) select top pageSize * from (select row_number() over(order by sno asc) as rownumber,* from student) temp_row where rownumber>((pageIndex-1)*pageSize); set statistics time on; -- 分页查询第2页,每页有10条记录 select top 10 * from (select row_number() over(order by sno asc) as rownumber,* from student) temp_row where rownumber>10;
标签:10,分页,over,sqlserver,number,rownumber,select,row From: https://www.cnblogs.com/zq1003/p/17046262.html