//分页存储过程 //可根据需求在此存储过程上进行扩展 //该存储过程未返回总页数 create proc PagerManager @pageindex int, @pagesize int, @tablename varchar(100), @orderbycol varchar(100) as begin declare @sqlstr varchar(8000) declare @beginindex int declare @endindex int set @beginindex = (@pageindex-1)*@pagesize+1 set @endindex = @pageindex*@pagesize print @pagecount set @sqlstr='select * from ( select *,ROW_NUMBER()over (order by '+@orderbycol+') as RowNum from '+@tablename+' ) as b where RowNum between '+cast(@beginindex as varchar(10))+' and '+cast(@endindex as varchar(10)) exec(@sqlstr) end