Database Management Simplified

Ross Group Inc  MemberzPlus  Blogs  |  News  |  Careers  |  Contact    Twitter CommitDBA LinkedIn CommitDBA

CommitDBA Blogs

See What we are Talking About!

CommitDBA Blog

SQL 2012 Tips for Developers

By: Joe Cuesta, CommitDBA staff Database Administrator

October 10, 2012

New Features

SQL 2012 is packed with some great new features. The enhanced look alone of SSMS tells you its definitely starting to take on more of the Visual Studio feel. Below are just a couple of the new features in SQL 2012.

One of the new features the web guys are sure to love is the new pagination features of order by using offset and next only. While reducing the amount of rows in a result set, it also helps improve performance. No more selecting all the rows from a query and paging through the results, now you can select only the rows you need.

Below is an example from the Adventureworks2012 database; this example returns 20 rows starting at row 20:

Select [BusinessEntityID], [Name]
From [Sales].[Store]
Order By [BusinessEntityID]
Offset 20 Rows
Fetch Next 20 Rows only

Another new feature in SQL 2012 is sequences. Sequences have been around a long time in Oracle and they are finally here in SQL Server 2012. A sequence is a user defined object which is used to generate a sequence of numbers. It is similar to an identity but it is independent of the table.

Sequences are much more flexible than identities and are easier to generate and view the next ID. Other advantages of sequences include setting maximum values, reseeding and changing step size, cycling the sequence or even de-incrementing.

Below is a simple way to create a sequence that will show up in the database under Programmability -> Sequences:

Create Sequnce [dbo].[Sequence_1]
As [int]

These are just two of the many great features added to SQL Server 2012 which should be of great use to you. Next time focus will be on features for the DBA followed by new and improved BI design and development.

From database assessments to complete database management, CommitDBA can assist your company today. For more information about how CommitDBA can work for you – give us a call at (800) 734-9304.

Got database support needs?
Professional and Affordable DBA and Data Services

Contact us Today