Pagination in SQL Server 2012

Bandi
Posted by Bandi under Sql Server category on | Points: 40 | Views : 475
DECLARE @PageSize int = 10, @PageNumber int = 1
SELECT *
FROM City
ORDER BY CityName
OFFSET (@PageNumber-1)*@PageSize ROWS -- 10 rows
FETCH NEXT @PageSize ROWS ONLY -- 1st page



Pass different values for @PageNumber and @PageSize variables to fetch different pages data in front end

Comments or Responses

Login to post response