RSS

OFFSET … FETCH NEXT IN SQL SERVER 2012 RC0

19 Feb

This is New Feature in SQL Server 2012 i see this feature is very good .

OFFSET  command  —- provides a starting point for the SELECT statement , Form where the Select will begin

FETCH command   —– provides how many records to return at a time

in SQL Sever 2012

Use AdventureWork

GO

SELECT Name,ModifiedDate  FROM Production.Culture

ORDER BY name

offset 2 rows ——- Select the rows from tha table expected the 2 rows

FETCH NEXT 3 ROWS ONLY — show the first 3 rows from the result return after the OFFSET Command

IF you want to make this statment in Oldest Version you will make it like this

Use AdventureWork

GO

SELECT top 3 Name,ModifiedDate  FROM Production.Culture

where name not in (‘Arabic’,’Chinese’)

ORDER BY name

 
Leave a comment

Posted by on February 19, 2012 in New Feature

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s