首页 > 代码库 > SQL Server 2012 新的分页函数 OFFSET & FETCH NEXT

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;