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多种分页性能的比较

 

相关文章:

  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2021-07-13
  • 2021-06-25
  • 2021-09-24
猜你喜欢
  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
  • 2021-11-13
  • 2022-01-07
  • 2021-12-25
相关资源
相似解决方案