标签:
create proc usp_getPageData @totalCount int output,--总页数 @pageIndex int ,--当前面索引 @pageCount int--每一页显示的记录数 as --获取拥有行号的结果集 --select ROW_NUMBER() over(order by sid) , * from dbo.vw_GetStockInfo --从拥有行号的结果集中再进行查询,使用行号进行条件的判断:获取结果集 select * from (select ROW_NUMBER() over(order by sid) id , * from dbo.vw_GetStockInfo) temp where id between (@pageIndex-1)*@pageCount+1 and @pageIndex*@pageCount --获取总页数 set @totalCount=CEILING((select count(*) from vw_GetStockInfo) *1.0/@pageCount) go
标签:
原文地址:http://www.cnblogs.com/DKnight/p/4513129.html