存储过程实现自定义分页

分页存储过程:

create procedure sp_GetCurentPage
(@pagesize int,                           --页面大小
@pageindex int)                         --当然页号
as
begin
 with temptbl as (
SELECT ROW_NUMBER() OVER (ORDER BY address desc)AS Row, * from test )
 SELECT * FROM temptbl where Row between (@pageindex-1)*@pagesize+1 and (@pageindex-1)*@pagesize+@pagesize
end

posted on 2007-10-26 14:56  ferrari  阅读(195)  评论(0编辑  收藏  举报

导航