sqlserver使用窗口函數(shù)實(shí)現(xiàn)分頁(yè)
alter proc [dbo].[usp_getstupage]
@pageindex int =1,--當(dāng)前頁(yè)碼
@pagesize int =10,--頁(yè)容量
@pagecount int output--輸出總頁(yè)數(shù)
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
更多信息請(qǐng)查看IT技術(shù)專(zhuān)欄