-- 分页查询语句
select * from PE_Comment
order by UpdateTime desc
offset ((@pageIndex-1)*@pageSize) rows
fetch next @pageSize rows only;
-- 举例:分页查询第5页,每页10条记录
select * from PE_Comment
order by UpdateTime desc
offset 40 rows
fetch next 10 rows only ;
此语句仅在SQLServer2012以上版本支持。