Sql Server 存储过程分页

来源:互联网 发布:java 八皇后算法 编辑:程序博客网 时间:2024/06/05 01:19
create proc usp_GetMyPhotos @pageIndex int,   --当前页码 @pageSize int,   --每页多少条 @pageCount int output  --计算  总共多少页as declare @count int --总共多少条 select @count =COUNT(*) from room set @pageCount = CEILING( @count*1.0/@pageSize) select * from(select *,ROW_NUMBER() over(order by ids desc) as numfrom room) as twhere num between @pageSize*(@pageIndex-1) + 1 and @pageSize*@pageIndexdeclare @n intexec usp_GetMyPhotos 4,3,@n outputprint @n

0 0
原创粉丝点击