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;
sql server2014分页存储过程(offset fetch next)
最新推荐文章于 2024-02-17 11:39:18 发布