分业的存储过程
proc up_GetPagedData
@pi int,--页码
@ps int, --页容量
@rc float output, --总行数
@pc float output--总页数
as
begin
select @rc=COUNT(cid) from Classes where CIsDel=0--查出总行数
select @pc=CEILING(@rc/@ps) -- 算出总页数 CEILING(1.1)=2 floor(1.1)=1
select * from (
select ROW_NUMBER() over(order by cid) as RNum,* from Classes where CIsDel=0
) as temp
where RNum >(@pi-1)*@ps and RNum<=@pi*@ps
end

浙公网安备 33010602011771号