With the release of SQL 2012 a lot of modifications has been added to T-SQL to help Developers and DBA improve the performance of their queries. But Before we start we need to state that the News SSMS (SQL Server Management Studio) is now based on the engine of Visual Studio, Same look and feel and the powerful features of Visual Studio now will help you write and manage your queries.
The Intellisense improved a lot in this version of SQL Server which will save you a lot of time.
Offset and Fetch
In Earlier versions of SQL Server in order to create paging in your application you need to handle this through your Datagrids or though a complex – performance impacting Stored Procedures.
In 2012 a New TSQL functions has been introduced to improve your paging methodology.
for example to get the next 10 rows in Employee table you can use the following command.
–Leave first 10 rows and Fetch next 5 rows
SELECT ProductID, Name
ORDER BY NAME
OFFSET 10 ROWS
FETCH NEXT 5 ROWS ONLY