标签:blog os ar div sp log on c size
CREATE procedure p_splitpage @sql nvarchar(4000), --要执行的sql语句 @page int=1, --要显示的页码 @pageSize int, --每页的大小 @pageCount int=0 out, --总页数 @recordCount int=0 out --总记录数 as set nocount on declare @p1 int exec sp_cursoropen @p1 output,@sql,@scrollopt=1,@ccopt=1,@rowcount=@pagecount output set @recordCount = @pageCount select @pagecount=ceiling(1.0*@pagecount/@pagesize) ,@page=(@page-1)*@pagesize+1 exec sp_cursorfetch @p1,16,@page,@pagesize exec sp_cursorclose @p1 GO
SQLSERVER一个比较不错的分页存储过程p_splitpage
标签:blog os ar div sp log on c size
原文地址:http://www.cnblogs.com/eketeam/p/3976628.html