存储过程分页 简单列子
create proc getdatabypage
@pagesize int,
@pageindex int
as
begin
select * from
(select *, ROW_NUMBER() over(order by id) as pageindex from MyOrders) as t1
where t1.pageindex between(@pageindex-1)*@pagesize+1 and @pagesize*@pageindex
end
@pagesize int,
@pageindex int
as
begin
select * from
(select *, ROW_NUMBER() over(order by id) as pageindex from MyOrders) as t1
where t1.pageindex between(@pageindex-1)*@pagesize+1 and @pagesize*@pageindex
end