sql server分页存储过程
Posted 小小高
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql server分页存储过程相关的知识,希望对你有一定的参考价值。
create proc [dbo].[messageMgr] @pageSize int, @pageIndex int, @rcount bigint output--输出查询总记录数 as begin declare @startRowNum int; declare @endRowNum int; set @startRowNum=@pageSize*(@pageIndex - 1)+1; set @endRowNum=@pageIndex*@pageSize; select * from ( SELECT ROW_NUMBER() over(order by a.short_message_time desc) as number,* FROM short_message_info as a) as a where a.number between @startRowNum and @endRowNum; select @rcount=count(number) from ( SELECT ROW_NUMBER() over(order by a.short_message_time desc) as number,* FROM short_message_info as a) as a end
以上是关于sql server分页存储过程的主要内容,如果未能解决你的问题,请参考以下文章