Monday, May 20, 2013

SQL Server 2012 New Features - Pagination

Pagination in SQL SERVER 2012 is now very easy, previously ROW_NUMBER(), TOP, Order BY clauses need to be used to get similar output.

Using OFFSET and FETCH is bit faster than using ROW_NUMBER(), TOP, Order BY clauses and very simple to use for Ad-Hoc paging.

OFFSET: Specifies the number of rows to skip before it starts to return rows from the query expression. The value can be an integer constant or expression that is greater than or equal to zero.

FETCH: Specifies the number of rows to return after the OFFSET clause has been processed. The value can be an integer constant or expression that is greater than or equal to one.

No comments:

Post a Comment