首页 > 其他 > 详细

sq分页

时间:2019-12-05 16:30:02      阅读:93      评论:0      收藏:0      [点我收藏+]

 

create proc RowNumber @pageindex int,@pagesize int
AS
BEGIN

select * from 
(select ROW_NUMBER() OVER(order by CustomerID desc) as px,* from Customers) as a
where a.px between ((@pageindex - 1)* @pagesize + 1) and (@pageindex*@pagesize)

END

 

create proc Offset_Fetch @pageindex int,@pagesize int
AS
BEGIN

select * from Customers order by CustomerID desc
offset ((@pageindex - 1) * @pagesize) rows
fetch next @pagesize rows only  

END

 

参考:Sql Server多种分页性能的比较

 

sq分页

原文:https://www.cnblogs.com/Tpf386/p/11989098.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!