Chapter 22. SQL Server Denali: what’s coming next in T-SQL
Last November when I was in Seattle for the PASS Summit 2010, Microsoft announced the first public Community Technology Preview (CTP1) of Microsoft SQL Server, code-named “Denali.” In this chapter, I’ll talk about some new features of the T-SQL language:
- OFFSET and FETCH
- SEQUENCE
- EXECUTE ... WITH RESULT SETS
- THROW
The ORDER BY clause, used to sort the query result set, has two interesting options in Denali that allow you to simplify the ad hoc paging of a query result set: OFFSET and FETCH. In the following scenario, you can see typical examples.
Here’s the OFFSET option:
This code specifies the number of rows to skip before starting to return rows from the query expression. The value can be an integer, a constant, or an expression that’s greater than or equal to 0.
Here’s the FETCH option:
This code specifies the number of rows to return after the OFFSET clause has been processed. The value can be an integer, a constant, or an expression that’s greater than or equal to 1.