SQL 高效分页查询

9/1/2015来源:SQL技巧人气:1385

SQL 高效分页查询
declare @page int --页码declare @pagecount int;--每一页显示的记录数set @page=2set @pagecount=6select * from (select *,row_number() over( order by id asc) as row from ADTypes) as a where row between (@page*@pagecount-@pagecount+1) and (@page*@pagecount)