存储过程的分页

来源:互联网 发布:淘宝怎么使用不了花呗 编辑:程序博客网 时间:2024/05/17 08:49

存储过程的分页

create procedure blog_page

@pageSize int,

@pageIndex int,

@pageCount int output

as

begin

declare @totleRecords int

select @totleRecords=count(id) frombolg_content

set @pageCount=ceiling(@totleRecords/(@pagesize+0.0));

with temp as (select row_number() over(order by id)as hang,* from bolg_content)

select * from temp where hang between(@pageIndex-1)*@pageSize+1 and @pageIndex *@pageSize

return @totleRecords

end


原创粉丝点击