经典分页SQL

declare @col int

select top {PageSize * (PageIndex-1)+1} @col = [排序字段]
from [表名|视图名]
[ where 查询条件 ]
order by [排序字段] asc|desc

--@col 变成本页第一条的位置(可以是ID,或时间等,只要是有序的东西)

select top PageSize 需要显示的字段
from [表名|视图名]
where [排序字段] >= @col
[ and 查询条件 ]
order by [排序字段] asc|desc
--查询@col向后的PageSize大小的东西
原文地址:https://www.cnblogs.com/kevinge/p/1238104.html