create proc proc_Page
(
@pageIndex int,
@pageSize int,
@Count int output
)
as
begin
declare @start int = (@pageIndex-1)*@pageSize +1
declare @end int = @pageIndex * @pageSize
select @Count = count(*) from UserInfo
select * from
(select ROW_NUMBER() over (order by UID) as No,* from UserInfo)
T where t.No between @start and @end
end
drop proc proc_Page
declare @count int
exec proc_Page 1,3,@count output
select @count
分页存储过程
原文:https://www.cnblogs.com/yiweizheng/p/12322835.html