sqlserver使用窗口函数实现分页
alter proc [dbo].[usp_getstupage]
@pageindex int =1,--当前页码
@pagesize int =10,--页容量
@pagecount int output--输出总页数
as
begin
select @pagecount=ceiling((count(id)*1.0)/@pagesize) from studentsinfo
select * from (
select *,row_number() over(order by id) as rownum from studentsinfo
)as t where t.rownum between (@pageindex-1)*@pagesize+1 and @pageindex*@pagesize
end
更多信息请查看IT技术专栏