Chapter 22. SQL Server Denali: what’s coming next in T-SQL

 

Sergio Govoni

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

OFFSET and FETCH

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:

OFFSET {integer_constant | offset_row_count_expression} {ROW | ROWS}

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:

FETCH {FIRST | NEXT} {integer_constant |
fetch_row_count_expression} {ROW | ROWS} ONLY

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.

SEQUENCE

 
 
 
 

EXECUTE...WITH RESULT SETS

 
 

THROW

 
 
 

Summary

 
 
 

About the author

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest