SQL Server 2012 新的分页函数 OFFSET & FETCH NEXT
DECLARE @page INT, @size INT;
select @page = 300, @size = 10
SELECT *
FROM gpcomp1.GPCUST
WHERE company like 'a%'
ORDER BY CUSTNO
OFFSET (@page -1) * @size ROWS
FETCH NEXT @size ROWS ONLY;
小小菜鸟一枚
DECLARE @page INT, @size INT;
select @page = 300, @size = 10
SELECT *
FROM gpcomp1.GPCUST
WHERE company like 'a%'
ORDER BY CUSTNO
OFFSET (@page -1) * @size ROWS
FETCH NEXT @size ROWS ONLY;