create procedure sp_GetCurentPage (@pagesize int, --页面的大小@pageindex int) --当然的页号asbegin with temptbl as (SELECT ROW_NUMBER() OVER (ORDER BY address desc)AS Row, * from test ) SELECT * FROM temptbl where Row between (@pageindex-1)*@pagesize+1 and (@pageindex-1)*@pagesize+@pagesizeend
注:由于这里引入了临时表来解决分页处理,加之服务器上的内存一般都比较大,因此可以容纳临时表处理。