当前位置: 代码迷 >> 综合 >> sql server2014分页存储过程(offset fetch next)
  详细解决方案

sql server2014分页存储过程(offset fetch next)

热度:77   发布时间:2023-12-13 15:44:41.0
declare @total int,@pgcount int
exec splitpage 1,10,@total output,@pgcount output

create proc [dbo].[splitpage]( @page int, --第@page页 @size int, --每页@size行 @total int output, --总行数@pgcount int output --总页数)asbegin select @total=count(1) from dl_capitalselect @pgcount=CEILING((@total+0.0)/@size) select *,@total as total,@pgcount as pgcountfrom dl_capitalorder by id offset (@page-1)*@size rows fetch next @size rows onlyend;



  相关解决方案