October 2012
Intermediate to advanced
238 pages
5h 17m
English
OFFSET and FETCH are two new clauses introduced in SQL erver 2012. Used together in your queries,
they allow you to extract a portion of rows from your result set.
We will look at typical SELECT query which you can run against the AdventureWorks database and add in ORDER BY clause.
SELECT BusinessEntityID, FirstName, MiddleName, LastName FROM [Person].[Person] ORDER BY BusinessEntityID
The following result set would be returned:

The query returns over 19,000 rows. However, what if you wanted to retrieve just a selection of rows from within that result set and using the SELECT TOP statement doesn't deliver the record you need? In comes ...