Top Banner
Top 12 Features of SQL Server 2012 Microsoft has introduced SQL Server 2012 to the world and it's time for IT professionals to start to come to speed on what's new. Microsoft has introduced SQL Server 2012 to the world and it's time for IT professionals to start to come to speed on what's new in this highly anticipated version of SQL Server. 1. AlwaysOn Availability Groups -- This feature takes database mirroring to a whole new level. With AlwaysOn, users will be able to fail over multiple databases in groups instead of individually. Also, secondary copies will be readable, and can be used for database backups. The big win is that your DR environment no longer needs to sit idle. 2. Windows Server Core Support -- If you don't know what Windows Server Core is, you may want to come up to speed before Windows 8 (MS is making a push back to the command line for server products). Core is the GUI-less version of Windows that uses DOS and PowerShell for user interaction. It has a much lower footprint (50% less memory and disk space utilization), requires fewer patches, and is more secure than the full install. Starting with SQL 2012, it is supported for SQL Server. 3. Columnstore Indexes -- This a cool new feature that is completely unique to SQL Server. They are special type of read-only index designed to be use with Data Warehouse queries. Basically, data is grouped and stored in a flat, compressed column index, greatly reducing I/O and memory utilization on large queries. 4. User-Defined Server Roles -- DBAs have always had the ability to create custom database role, but never server wide. For example, if the DBA wanted to give a development team read/write access to every database on a shared server, traditionally the only ways to do it were either manually, or using undocumented procedures. Neither of which were good solutions. Now, the DBA can create a role, which has read/write access on every DB on the server, or any other custom server wide role. 5. Enhanced Auditing Features -- Audit is now available in all editions of SQL Server. Additionally, users can define custom audit specifications to write custom events into the audit log. New filtering features give greater flexibility in choosing which events to write to the log. 6. BI Semantic Model -- This is replacing the Analysis Services Unified Dimensional Model (or cubes most people referred to them). It's a hybrid model that allows one data model will support all BI experiences in SQL Server. Additionally, this will allow for some really neat text infographics 7. Sequence Objects -- For those folks who have worked with Oracle, this has been a long requested feature. A sequence is just an object that is a counter -- a good example of it's use would be to increment values in a table, based a trigger. SQL has always had similar functionality with identity columns, but now this is a discrete object. 8. Enhanced PowerShell Support -- Windows and SQL Server admins should definitely start brushing up on their PowerShell scripting skills. Microsoft is driving a lot of development effort into instrumenting all of their server-based products with PowerShell. SQL 2008 gave DBAs some exposure to it, but there are many more in cmdlets in SQL 2012. 9. Distributed Replay -- Once again this is answer to a feature that Oracle released (Real Application Testing). However, and in my opinion where the real value proposition of SQL Server is, in Oracle it is a (very expensive) cost option to Enterprise Edition. With SQL, when you buy your licenses for Enterprise Edition, you get everything. Distributed replay allows you to capture a workload on a production
35
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Features of SQL Server 2012.docx

Top 12 Features of SQL Server 2012Microsoft has introduced SQL Server 2012 to the world and it's time for IT professionals to start to come to speed on what's new.

Microsoft has introduced SQL Server 2012 to the world and it's time for IT professionals to start to come to speed on what's new in this highly anticipated version of SQL Server.

1. AlwaysOn Availability Groups -- This feature takes database mirroring to a whole new level. With AlwaysOn, users will be able to fail over multiple databases in groups instead of individually. Also, secondary copies will be readable, and can be used for database backups. The big win is that your DR environment no longer needs to sit idle.2. Windows Server Core Support -- If you don't know what Windows Server Core is, you may want to come up to speed before Windows 8 (MS is making a push back to the command line for server products). Core is the GUI-less version of Windows that uses DOS and PowerShell for user interaction. It has a much lower footprint (50% less memory and disk space utilization), requires fewer patches, and is more secure than the full install. Starting with SQL 2012, it is supported for SQL Server.3. Columnstore Indexes -- This a cool new feature that is completely unique to SQL Server. They are special type of read-only index designed to be use with Data Warehouse queries. Basically, data is grouped and stored in a flat, compressed column index, greatly reducing I/O and memory utilization on large queries.4. User-Defined Server Roles -- DBAs have always had the ability to create custom database role, but never server wide. For example, if the DBA wanted to give a development team read/write access to every database on a shared server, traditionally the only ways to do it were either manually, or using undocumented procedures. Neither of which were good solutions. Now, the DBA can create a role, which has read/write access on every DB on the server, or any other custom server wide role.5. Enhanced Auditing Features -- Audit is now available in all editions of SQL Server. Additionally, users can define custom audit specifications to write custom events into the audit log. New filtering features give greater flexibility in choosing which events to write to the log.6. BI Semantic Model -- This is replacing the Analysis Services Unified Dimensional Model (or cubes most people referred to them). It's a hybrid model that allows one data model will support all BI experiences in SQL Server. Additionally, this will allow for some really neat text infographics7. Sequence Objects -- For those folks who have worked with Oracle, this has been a long requested feature. A sequence is just an object that is a counter -- a good example of it's use would be to increment values in a table, based a trigger. SQL has always had similar functionality with identity columns, but now this is a discrete object.8. Enhanced PowerShell Support -- Windows and SQL Server admins should definitely start brushing up on their PowerShell scripting skills. Microsoft is driving a lot of development effort into instrumenting all of their server-based products with PowerShell. SQL 2008 gave DBAs some exposure to it, but there are many more in cmdlets in SQL 2012.9. Distributed Replay -- Once again this is answer to a feature that Oracle released (Real Application Testing). However, and in my opinion where the real value proposition of SQL Server is, in Oracle it is a (very expensive) cost option to Enterprise Edition. With SQL, when you buy your licenses for Enterprise Edition, you get everything. Distributed replay allows you to capture a workload on a production server, and replay it on another machine. This way changes in underlying schemas, support packs, or hardware changes can be tested under production conditions.10. PowerView -- You may have heard of this under the name "Project Crescent" it is a fairly powerful self-service BI toolkit that allows users to create mash ups of BI reports from all over the Enterprise.11. SQL Azure Enhancements -- These don't really go directly with the release of SQL 2012, but Microsoft is making some key enhancements to SQL Azure. Reporting Services for Azure will be available, along with backup to the Windows Azure data store, which is a huge enhancement. The maximum size of an Azure database is now up to 150G. Also Azure data sync allows a better hybrid model of cloud and on-premise solutions12. Big Data Support -- I saved the biggest for last, introduced at the PASS (Professional Association for SQL Server) conference last year, Microsoft announced a partnership with Hadoop provider Cloudera. One part of this involves MS releasing a ODBC driver for SQL Server that will run on a Linux platform. Additionally, Microsoft is building connectors for Hadoop, which is an extremely popular NoSQL platform. With this announcement, Microsoft has made a clear move into this very rapidly growing space.SQL 2012 is a big step forward for Microsoft -- the company is positioning itself to be a leader in availability and in the growing area of big data. As a database professional, I look forward to using SQL 2012 to bring new solutions to my clients.

Page 2: Features of SQL Server 2012.docx

Using SQL Server 2012 T-SQL New Features

IntroductionSQL Server 2012 “Denali” is the next major release of Microsoft database server. There are some new features that are added to T-SQL to make common tasks much easier. I will show how to use some of the new features in this article.

SequenceGenerating a sequence number, a.k.a. auto number, is a common task in an enterprise application. For a single table, you can specify identity field. But, if you want to have database wide sequential number, then you must devise something by yourself before SQL Server 2012. One solution to this problem is to create a table that has a numeric field can be used to store sequential number, then use SQL to increase it every time used one. In SQL Server 2012, we have a new solution - use Sequence.

Create Sequence

To create a Sequence in SQL Server 2012 is very simple. You can create it with SQL Server Management Studio or T-SQL.

1. Create Sequence with SQL Server Management StudioIn Object Explorer window of SQL Server Management Studio, there is a Sequences node under Database -> [Database Name] -> Programmability. You can right click on it to bring up context menu, and then choose New Sequence… to open the New Sequence window. In New Sequence window, you can define the new Sequence, like Sequence Name, Sequence schema, Data type, Precision, Start value, Increment by, etc. After entering all the required information, click OK to save it. The new Sequence will show up in Sequences node.

2. Create Sequence with T-SQLThe following T-SQL script is used to create a new Sequence:

 Collapse | Copy Code

CREATE SEQUENCE DemoSequenceSTART WITH 1INCREMENT BY 1;

Use Sequence

The new NEXT VALUE FOR T-SQL keyword is used to get the next sequential number from a Sequence.

 Collapse | Copy Code

SELECT VALUE FOR DemoSequence

Page 3: Features of SQL Server 2012.docx

One thing I want to mention in here is Sequence doesn’t support transaction, if you run this script:

 Collapse | Copy Code

BEGIN TRANSELECT NEXT VALUE FOR dbo.DemoSequenceROLLBACK TRAN

You can see even the transaction is rolled back at the end. The NEXT VALUE FOR will still return the next sequential number. This behavior is consistent with identity field.

Page DataA common situation for displaying page is how to display large amount of data in DataGrid. Earlier, the programmer usually used the paging feature of DataGrid to handle this situation. Therefore, by choosing a different page number, different set of data are displayed on the screen. However, how to retrieve data from database is multiplicity. A developer could:

1. Retrieve all data from database, and then let DataGrid to only display the current page data.

2. Retrieve the current page data from database by using temp table.3. Retrieve the current page data from database by using ROW_NUMBER() function.

The SQL Server 2012 provided a new way to retrieve current page data from database. Collapse | Copy Code

SELECT *FROM CustomersORDER BY CustomerIDOFFSET 10 ROWSFETCH NEXT 10 ROWS ONLY;

The OFFSET keyword and FETCH NEXT keyword allow the developer to only retrieve certain range data from database. If you compare this script with ROW_NUMBER() function introduced in SQL Server 2008, you can see this script is shorter and more intuitive.

 Collapse | Copy Code

SELECT *FROM (SELECT ROW_NUMBER() OVER(ORDER BY CustomerID) AS sequencenumber, *FROM Customers) AS TempTableWHERE sequencenumber > 10 and sequencenumber <= 20

Exception Handling

Page 4: Features of SQL Server 2012.docx

SQL Server 2005 introduced TRY CATCH block to handle exception in T-SQL. The TRY CATCH block is similar to whatever in C# language except you need always raise a new exception after catching it. There is no way to simply re-throw it.

A sample of T-SQL script with exception handling in SQL Server 2005:

 Collapse | Copy Code

BEGIN TRYBEGIN TRANSACTION – Start the transaction

-- Delete the CustomerDELETE FROM CustomersWHERE EmployeeID = ‘CACTU’

-- Commit the changeCOMMIT TRANSACTION

END TRYBEGIN CATCH

-- There is an errorIF @@TRANCOUNT > 0

ROLLBACK TRANSACTION

-- Raise an error with the details of the exceptionDECLARE @ErrMsg nvarchar(4000), @ErrSeverity intSELECT @ErrMsg = ERROR_MESSAGE(),

@ErrSeverity = ERROR_SEVERITY()

RAISERROR(@ErrMsg, @ErrSeverity, 1)END CATCH

In SQL Server 2012, by using Throw keyword, the above script will be changed to this:

 Collapse | Copy Code

BEGIN TRYBEGIN TRANSACTION -- Start the transaction

-- Delete the CustomerDELETE FROM CustomersWHERE EmployeeID = ‘CACTU’

-- Commit the changeCOMMIT TRANSACTION

END TRYBEGIN CATCH

-- There is an errorROLLBACK TRANSACTION

-- Re throw the exceptionTHROW

END CATCH

Also, you can use Throw to replace RAISERROR function:

 Collapse | Copy Code

Page 5: Features of SQL Server 2012.docx

THROW 51000, ‘The record does not exist.’, 1;

Enhanced EXECUTE keywordThe EXECUTE keyword is used to execute a command string. The previous version SQL Server only has WITH RECOMPILE option to force new plan to be re-compiled. The SQL Server 2012 dramatically improved this part. The option part is like this right now.

 Collapse | Copy Code

[ WITH <execute_option> [ ,…n ] ]

<execute_option>::={

RECOMPILE| { RESULT SETS UNDEFINED }| { RESULT SETS NONE }| { RESULT SETS ( <result_sets_definition> [,…n] ) }

}

<result_sets_definition> ::={

({ column_name data_type[ COLLATE collation_name ][ NULL | NOT NULL ] }[,…n ]

)| AS OBJECT

[ db_name . [ schema_name ] . | schema_name . ]{table_name | view_name | table_valued_function_name }

| AS TYPE [ schema_name.]table_type_name| AS FOR XML

}

The way to use the new added options is like this:

 Collapse | Copy Code

EXEC CustOrderDetail ‘2’WITH RESULT SETS(

(ProductName1 varchar(100),Unitprice1 varchar(100),Quantity1 varchar(100),Discount1 varchar(100),ExtendedPrice1 varchar(100))

);

Get Metadata

Page 6: Features of SQL Server 2012.docx

Application sometimes needs more insight of the SQL script result set. In the past, you needed to write a complicated script to query system tables or views, e.g. sys.objects, to get all the information. In SQL Server 2012, the new system stored procedure sp_describe_first_set makes the work trivial.

 Collapse | Copy Code

sp_describ_first_result_set @tsql = N’SELECT * FROM customers’

SummaryThere are more T-SQL new features in the upcoming SQL Server 2012. Majority of them are designed to improve development efficiency and reduce development effort.

New T-SQL features in SQL Server 2012 – OFFSET and FETCH –

Microsoft has decided in SQL Server 2012, that they will modify the ORDER BY clause and do

what MySQL has been doing for a long time – providing simple functions for paging result sets.

This comes in the form of OFFSET and FETCH.

Now, I’m not saying that this was previously not possible in SQL Server. There are solutions to

this problem in other versions of the product in the form of temp tables, ROW_NUMBER() and

TOP but I prefer OFFSET and FETCH to the others – it’s just simple! 

I am using SQL Server 2012 Express and the AdventureWorks 2012 database for this

demonstration.

So lets look at some data and I have decided to query some of the fields from the

TransactionHistory table under the Production schema.

SELECT TOP 10

TransactionID

, ProductID

, TransactionDate

, Quantity

, ActualCost

FROM

Production.TransactionHistory;

This table contains approximately 133,500 rows – not a massive amount in today’s world but for the

purposes of this article, lets say I wanted to write queries to page through this data sorted by newest

transactions and I wanted to display 20 rows per page.

Page 7: Features of SQL Server 2012.docx

Using OFFSET and FETCH in SQL Server 2012So here is an example. Note that OFFSET and FETCH are added after the ORDER BY clause.01 SELECT

02 TransactionID

03 , ProductID

04 , TransactionDate

05 , Quantity

06 , ActualCost

07 FROM

08 Production.TransactionHistory

09 ORDER BY TransactionDate DESC

10 OFFSET 0 ROWS

11 FETCH NEXT 20 ROWS ONLY;

OFFSET provides a starting row from which to display the result set. FETCH instructs the query

to display the number of rows you want in your result set from the OFFSET point.

Note that NEXT or FIRST can be supplied for FETCH and are synonyms for ANSI

compatibility. You can also type ROW or ROWS, again they are synonyms for ANSI

compatibility.

So this is nice and easy, for the next page of results, the OFFSET value would be changed to 20

and then 40 etc.

OFFSET and FETCH can accept variables so for example:01 DECLARE @OffsetRows tinyint = 0

02 , @FetchRows tinyint = 20;

03 SELECT

04 TransactionID

Page 8: Features of SQL Server 2012.docx

05 , ProductID

06 , TransactionDate

07 , Quantity

08 , ActualCost

09 FROM

10 Production.TransactionHistory

11 ORDER BY TransactionDate DESC

12 OFFSET @OffsetRows ROWS

13 FETCH NEXT @FetchRows ROWS ONLY;

You can use expressions in OFFSET and FETCH:1 ORDER BY TransactionDate DESC

2 OFFSET @OffsetRows - 0 ROWS

3 FETCH NEXT @FetchRows - @OffsetRows + 1 ROWS ONLY;

And I really like this – plugging in a scalar sub queries:01 SELECT

02 TransactionID

03 , ProductID

04 , TransactionDate

05 , Quantity

06 , ActualCost

07 FROM

08 Production.TransactionHistory

09 ORDER BY TransactionDate DESC

10 OFFSET @OffsetRows ROWS

Page 9: Features of SQL Server 2012.docx

11 FETCH NEXT (SELECT 20) ROWS ONLY;

So imagine that (SELECT 20) was in fact reading a table somewhere in your system (SELECT

PageSize FROM PageSetting WHERE SiteID = 5) which controlled the number of rows to be

displayed for each query.

OFFSET and FETCH versus ROW_NUMBER()I’m not going to go into detail about all the methods of paging which have been employed in

previous versions of SQL Server and start drawing comparisons and conclusions over

performance (perhaps I will in a future post) but the one which immediately springs to mind as

an alternative to OFFSET and FETCH is ROW_NUMBER()

So a quick comparison between the two methods shows the following:

Using OFFSET and FETCH01 SELECT

02 TransactionID

03 , ProductID

04 , TransactionDate

05 , Quantity

06 , ActualCost

07 FROM

08 Production.TransactionHistory

09 ORDER BY TransactionDate DESC

10 OFFSET 0 ROWS

11 FETCH NEXT 20 ROWS ONLY

Using ROW_NUMBER() with CTE01 WITH Paging_CTE AS

02 (

03 SELECT

Page 10: Features of SQL Server 2012.docx

04 TransactionID

05 , ProductID

06 , TransactionDate

07 , Quantity

08 , ActualCost

09 , ROW_NUMBER() OVER (ORDER BY TransactionDate DESC) AS RowNumber

10 FROM

11 Production.TransactionHistory

12 )

13 SELECT

14 TransactionID

15 , ProductID

16 , TransactionDate

17 , Quantity

18 , ActualCost

19 FROM

20 Paging_CTE

21 WHERE RowNumber > 0 AND RowNumber <= 20

So what do you think? It’s certainly easier to write a query using OFFSET and FETCH as there

is less involved. There is one less column too because “RowNumber” is not needed for the

OFFSET and FETCH version.

If I were a betting man, I would say that the execution plans are different between the two

queries. So lets take a look.

Using OFFSET and FETCH…

Page 11: Features of SQL Server 2012.docx

Using ROW_NUMBER()…

There is certainly more going on in the second one right? As I wrote above, I’m not intending to

draw any conclusions on this because I am not doing any thorough testing here.

Finally, if you want to guarantee stable results in your OFFSET and FETCH paging solution

there are two things that you must implement.

1. You should ensure that the underlying data does not change and that involves running the queries inside

a transaction using either snapshot or serializable transaction isolation.

2. The ORDER BY clause needs to contain a column or combination of columns that are guaranteed to be

unique.

Top 10 new Features in SQL 2012

The release of Microsoft SQL Server 2012 brings a whole host of important changes to Microsoft's

enterprise data platform, including changes in the editions that Microsoft will offer as well as a new

licensing model. In addition, SQL Server 2012 introduces many performance, business intelligence (BI),

and development enhancements. Here's a rundown of the top 10 most important new features in SQL

Server 2012.

10. Simplified editions -- SQL Server 2012 will be delivered in three main editions: Enterprise, Business

Intelligence, and Standard. The Enterprise edition contains all of the product's features. The Business

Intelligence edition contains all of the BI capabilities but lacks some of the higher-end availability features.

The Standard edition provides basic relational, BI, and availability capabilities. Microsoft has retired the

Datacenter, Workgroup, and Standard for Small Business editions but will continue to provide the

Developer, Express, and Compact Editions. The Web edition will be offered only to web hosting providers

who have a Services Provider License Agreement (SLPA).

9. Processor core licensing model -- With SQL Server 2012, Microsoft has moved away from counting

sockets to a new core-based licensing model. The Enterprise edition can be licensed only per core. The

list price is $6,874 per core. The Business Intelligence edition is licensed only per server; it goes for

$8,592 per server. You must also purchase Client Access Licenses (CALs) per user. The CAL price has

Page 12: Features of SQL Server 2012.docx

increased to $209 per CAL. The Standard edition has the option of being licensed either per core or per

server; it costs $1,793 per core or $898 per server.

8. Support for Windows Server Core -- Windows Server Core is designed for infrastructure applications

such as SQL Server that provide back-end services but don't need a GUI on the same server. The

inability to run previous versions of SQL Server on Windows Server Core always seemed ironic. SQL

Server 2012's support for Windows Server Core enables leaner and more efficient SQL Server

installations and also reduces potential attack vectors and the need for patching.

7. Data Quality Services -- Data Quality Services (DQS) is a knowledge-based tool that helps ensure

your databases contain high-quality, correct data. DQS performs data cleansing, which can modify or

remove incorrect data. It also does data matching to identify duplicate data and profiling that intelligently

analyzes data from different sources. DQS is integrated with both SQL Server Integration Services and

Master Data Services.

6. T-SQL enhancements -- SQL Server 2012 provides many T-SQL enhancements, including support for

sequences, a new TRY_CONVERT operator for data conversions, OFFSET and FETCH for data paging,

a new FORMAT() function for easier data formatting, a new THROW operator for enhanced error

handling, and improved T-SQL windowing functions.

5. Contained databases -- Contained databases make it easy to deploy new databases and to move

databases between different SQL Server instances. Users of a contained database don't need logins for

the SQL Server instance. Instead, all authentications are stored in the contained database. Contained

databases have no configuration dependencies on the instance of SQL Server that they're hosted on.

4. Columnar index -- Primarily intended to support data warehousing, the columnar index feature

incorporates the same high-performance/high-compression technology that Microsoft uses in PowerPivot

into the SQL Server relational database engine. Columnar indexes store data column-wise, and only the

necessary columns are returned as query results. Depending on the data, Microsoft states this technology

can provide up to 10 times improvement in query performance with reduced I/O.

3. SQL Server Data Tools -- One of the most important developer-oriented features in SQL Server 2012

is the new SQL Server Data Tools development environment (formerly coded-named Juneau). SQL

Server Data Tools uses the Visual Studio 2010 shell, and it enables model-driven database development

as well as T-SQL and SQLCLR development and debugging. SQL Server Data Tools can connect to SQL

Server 2005 and later as well as to SQL Azure.

2. Power View -- Power View (formerly code-named Crescent) is a graphical data navigation and

visualization tool that enables end-user reporting. Power View provides a report designer that lets users

take elements from a semantic data model that's constructed by IT and use them to create powerful

interactive reports that can be embedded in .NET applications or published to SharePoint.

1. AlwaysOn Availability Groups -- The most important feature in the SQL Server 2012 release is the

new AlwaysOn Availability Groups high availability technology. AlwaysOn Availability Groups is

essentially the evolution of database mirroring. AlwaysOn can protect multiple databases. It supports up

to four replicas and lets you mix and match both synchronous and asynchronous connections. In addition,

unlike database mirroring, the data in the replicas can be actively queried.

Page 13: Features of SQL Server 2012.docx

SQL Server 2012 - Top Features

I was recently tasked with giving a presentation on the differences in SQL Server Standard versus

Enterprise as well as the differences in going to SQL Server 2012. After spending some time looking into

all the differences, I thought it would good to share what I believe to be some of the key advantages of

upgrading to SQL Server 2012 now that is available to the public. 

 

In the course of my 10+ years dealing with SQL Server I have worn each of the three hats necessary in

working with this software. I have taken the database administrator role of setting up the roles, security

and backups. I have also taken on the developer role of only designing the database tables and creating

the stored procedures, functions and triggers. Lastly, I have had the role of business intelligence,

designing the packages and setting up the tasks to run those packages. In this article, I’ll focus on the

features I like best from these three areas of the latest version of the software.

 

Security and Availability

Data is the heart and blood of any large organization. If that data is lost or compromised it can be

devastating. With SQL Server 2012 there several new measures that are available to help in this area, but

I really like two of them. 

 

The first is Server Core Support. This is a GUI-less setup that requires approximately 50% less disk and

memory utilization. With this setup you do not need anything on the OS to run SQL Server, which reduces

the number of patches required for the OS. Now be warned, if you are not familiar in dealing with GUI-

less interfaces; this could pose some frustration. You no longer have the ability to point, click or drag

anymore. Everything is performed either through a DOS interface, as shown below, or by PowerShell

scripts. However, if you are familiar with GUI-less interfaces or by chance you are a PowerShell guru, this

may be right up your alley. In either case this is a nice option to have.

Page 14: Features of SQL Server 2012.docx

 

The next item is Always On Availability Groups. This is a great feature that is a result of SQL Azure and

the way Microsoft maintains backups. This feature has been rolled down and incorporated at the on-site

level. In a normal failover situation, you have to failover a single database at a time or the entire instance

by using clustering. With the new Availability Groups feature, you can now create groups of multiple

databases and have them all failover at the same time. So if you have four databases on your server that

work together in some fashion, you can create an availability group of those four databases and have

them failover at the same time if anything goes wrong. 

You can set the level of the issue that causes the failover from major events with the server or outside

server issues like connectivity problems. When these groups failover you can then split them across

separate servers if you wish. That way you are not forced to have a standby machine capable of handling

the full load of the production server, but rather a couple of smaller cheaper machines that the load could

be spread over evenly. Second, the “Always On” portion of this feature allows you to create multiple read-

only actively up-to-date copies of the production data. In the event that something does happen

(hardware failure within the server to a software failure within SQL Server) the availability group changes

the read-only copies to the active copy and all updates are then sent to the newly active versions. 

This is all done behind the scenes and there are no connectivity concerns with the software as it doesn’t

know there was a change. Also these read-only copies can be used to perform back-up operations as

well as reporting and read-only data pulls can be pulled from them. This helps take the load off of the

production server as well. This new feature gives us much more power and flexibility in how we handle

disaster recovery and balancing the workload on the production server.

Page 15: Features of SQL Server 2012.docx

 

Manageability

For any DBAs out there I’m sure you have had to migrate a single database from one instance to another.

This might be due to moving everything over to a newer more powerful server or simply moving from

development to production. Well it’s never as easy as just moving the database from one instance to

another. There is a lot of baggage stored for that database at the instance level. With SQL Server 2012

we have something called Contained Databases. This new feature helps reduce or eliminate extra

baggage that is stored at the instance level for a particular database. Now you can store items like the

user information at the database level. This will not only help in moving this database, but it will also help

cut down on the occurrences of orphaned user’s at the instance level. While this feature is great it’s not

quite complete yet, but it is a giant leap forward.

 

Another new feature for DBAs out there is User-Defined Server Roles. We have always been able to

create roles on the server, but never server-wide roles. This new feature will allow a DBA to create a role

with, say read-write access for the 10 databases being used in a particular project, and assign that role to

the people on the development team. This new feature simplifies and builds in this feature, as opposed to

Page 16: Features of SQL Server 2012.docx

the DBA possibly using undocumented measures to keep control of who has access at a sever level.

 

 

Data Performance

Having worked on database tables containing billions of rows and growing at a rate of over a million rows

daily, I realize that getting the needed data out of the database can sometimes be hard work. In SQL

Server 2012 you get a new index type known as Column-Store Index. It is exactly what the name states.

The index is column-based and not row-based. The data is stored in a flat, compressed column index. Let

me give you an example of the power of this index. I was at a SQL event and sat in a one-hour session

that covered just this one item. The presenter gave a demonstration at the end that pulled a SELECT

COUNT(*) on a table with several billion rows; the query took less than a second. The screen blinked and

the time was still sitting at zero. Keep in the mind that the data was stored on an external USB drive and

not on the laptop itself. 

This is a very powerful indexing tool. Now that I have been giving this item tons of praise let me give you

the downside to it. This index is read-only and has to be rebuilt if there is any change in the data.

Threfore, it is meant for data warehouse situations and not live actively-changing data. Also you can only

have one index per table although you can include every column. This really isn’t an issue, but you should

know this up front.

Page 17: Features of SQL Server 2012.docx

 

 

Working with SQL data I have often wished T-SQL would do one thing or another automatically, so I

wouldn’t have to create additional code to achieve a desired result. Some of my wishes have been

answered. There are several T-SQL Enhancements in SQL Server 2012; I have picked four to describe

here. 

1. OFFSET/FETCH. An example of this is when you visit a web page and it listed results as X

number per page. This feature allows you to pull only the data the user wants to see and not pull back the

entire dataset. Basically the code is ‘OFFSET xx ROWS’ and ‘FETCH NEXT XX ROWS ONLY’. Before

you had to use either joins or sub-queries and it could get complicated pretty fast. Now, you simply tell T-

SQL how many rows to offset and then how many rows to fetch back. This certainly helps make the code

easier to write and read.

2. SEQUENCE. This is similar to the identity object you are currently using, but sequence can be

used across several tables and addresses several limitations of using identity alone. For example, you

can get the new value at any time even during an update. It’s possible to alter the properties of a

sequence object and you can define the minimum and maximum values as well cycle through those

values. There are some other differences, but this gives you a built-in feature that was hard to achieve

before.

3. THROW. In previous versions you could use RAISEERROR to show an error message, but this

required an error number to exist in sys.messages and you couldn’t re-throw the error. In SQL 2012, the

Page 18: Features of SQL Server 2012.docx

error number doesn’t have to exist in sys.messages. Basically it allows you to throw the error back up to

the application level. This allows the error to be handled more gracefully at the application level and

makes it easier on the developer. One thing to note isRAISEERROR is being deprecated as well. So it

should be used at a minimum going forward.

4. TRY_CONVERT. This gives you the ability to test whether a value can be converted and if not,

simply return aNULL value in lieu of causing an error. For example, the value ‘e’ is considered numeric,

but it cannot be converted and would cause an error. This type of error has caused issues for me in the

past, but now I have the ability to make my code smarter in how it will handle these situations.

 

I mentioned two of the items above for two reasons. Numbers 1 & 2 were mentioned because of the

added functionality they provide, but also because they may be familiar with some people as they have

been standard in other database engine products. The OFFSET/FETCH has been part of MySQL for

years and the SEQUENCE has been part of Oracle. I wanted to point this fact out because it allows

developers who have experience with other database engines an easier transition when coming over to

SQL Server 2012.

 

Business Intelligence

The last main topic I wanted to cover was the BI side of SQL. In the past I didn’t think much about any of

the different services that were available as far as providing data to the end-user. The reason being, more

than anything, was my lack of experience as compared to the DBA and developer roles. Most people at

an executive level don’t have a lot of time on their hands to drill through lines of data in a report. They

would prefer to have something visual and graphical in front of them that they can take a quick glance at

and see what is important to them.

Let me introduce you to PowerView. Now I am not a graphical or artistic person, but after using

PowerView it makes me think I am. This new tool is a brand new browser-based Silverlight report

authoring tool. It provides a high level of interactive reporting that allows you to access, explore, and most

important of all, visualize your data. If you really want to impress, you can tie in a timeline, and then

PowerView will dynamically change all the charts or graphs tied to it so you can visually see how the data

is changing over time. This is a powerful tool; not just to show statistics and numbers, but visually show

the change to the end-user.

Page 19: Features of SQL Server 2012.docx

 

The last item I want to mention is Data Alerts. This is a new data-driven alert feature that allows you to

setup and define alerts using existing Reporting Services reports. These alerts can be setup based on

criteria or scheduled to notify the user without having to execute anything manually. For example, if you

have a table that should have data inserted on a regular basis, you can set this up to send you an alert if

there were no updates/inserts in a specific time frame. That way you have a heads-up before a small

issue turns into a much larger one. Also the reverse is true, if you have a table that should not have the

data changed. There are numerous applications for this new feature due to the possible increase in

productivity it allows all developers.

 

Conclusion

I know this is only the tip of the iceberg for the new features and advancements that have been made in

the latest version of SQL Server and there are many, many more that are worth looking into. I hope you

feel as I did when I saw these items for the first time . I had that wow feeling and thought ‘That’s going to

make my life so much easier’. If you are looking to upgrade your current SQL Server I feel that most of

Page 20: Features of SQL Server 2012.docx

the items that I mentioned alone are good arguments to make the jump to SQL Server 2012. But when

you consider that all of them are available, plus all the features I didn’t mention it seems like a no brainer!

SQL Server 2012 ETL Framework Features in the New SSIS Catalog

One of the most frequently asked questions I get when I showcase the new SQL Server 2012 Integration Services

SSIS catalog is, “how will these new features overlap or replace my existing ETL Framework?”  

In most cases, this new feature set will be used to complement your existing ETL Framework instead of replace it if

you have ETL Framework Execution Control features.  A third-party ETL Framework would most likely continue to

work in SQL Server 2012, so you may opt not to use the SSIS catalog at all when you upgrade.  There is also the

option to not use the SQL Server 2012 project deployment model by keeping SSIS projects and packages in SSIS

Legacy Mode.  In the future, most third-party ETL Framework vendors will probably update their offerings to leverage

the new SSIS Catalog for a “best-of-both-options” scenario.  If you do not have an ETL framework today, the new

SSIS Catalog features will be a welcome addition to better manage and monitor your SSIS deployments.

In SQL Server 2012, the SSIS catalog is the central storage and administration point for SSIS projects, packages,

parameters and environments.  This catalog is part of a new and optional SSIS deployment model called the project

deployment model. The new SSIS Catalog is also optional. The project deployment model provides the ability to

define parameters for packages and projects, modify the parameter values at runtime, apply the same set of

parameter values for multiple packages and deploy the project as a unit.  The SSIS catalog stores the SSIS projects,

packages, parameters and environments. It can also be used for SSIS administration and troubleshooting reporting

within SQL Server Management Studio.  

The SQL Server 2012 out-of-the-box SSIS Catalog will include Configuration Management, Operational Reporting,

limited Performance Reporting and no default Execution Control features.  The table below is an unofficial listing of

what types of features are in the out-of-the-box SSIS Catalog versus many third-party ETL Frameworks.

Page 21: Features of SQL Server 2012.docx

Based on SQL Server Denali Community Technology Preview 3 feedback, the product team recently added a

package variable called “PackageExecutionID” that allows joined custom logging to be performed by third-party ETL

Frameworks in addition to the logging done by the SSIS Catalog.  

Microsoft Announces SQL Server 2012 R2 and SQL Server 2012 R3!

Today Microsoft has announced that the next two versions of SQL Server, which will include new features

such as Hekaton and clustered, writable columnstore indexes, will adopt the R2 and R3 monikers

respectively. Here is the tentative schedule:

SQL Server 2012 R2

o Q3 2013

o Hekaton in-memory database

SQL Server 2012 R3

o Q1 2014

Page 22: Features of SQL Server 2012.docx

o Clustered, writable columnstore indexes

Eric Hanson, Principal Program Manager Architect at Microsoft, talked about the decision in a recent

interview:

We wanted to build off of the success of SQL Server 2012 and, as with our well-received SQL Server

2008 R2 campaign, create a migration story that was more intuitive for our customers. We conducted several

usability studies and concluded that users don't care what year their software was released, and found it

easier to follow an upgrade path with simple, incremental release numbers."

Rock your data with SQL Server 2012 Parallel Data Warehouse (PDW) – What’s new?As I already stated out in my first post   I want share some insights about the new SQL Server

2012 version of Parallel Data Warehouse. In this post I will talk about some new features as

well as architecture changes.

ARCHITECTURE UPDATE

The SQL Server 2012 version of PDW introduces some major architecture changes:

As show in the picture below the Landing Zone and the Backup node have been removed

from the appliance and there good reasons for. The standard sizing of these component

didn’t met most of the customer requirements and it was very hard to find a

configuration that meets 80% of PDW customers. So decision has been made to remove

these components and customers have now more flexibilities to size the ETL and the

Backup node to their needs.

Page 23: Features of SQL Server 2012.docx

Expensive storage components have been replace by an economical high density Direct

Attached Storage

Virtualization of the Software Components based on Windows Server 2012 and

Hyper-V

Modular Design and Smarter Scale Out: SQL Server 2012 PDW has reshaped the

very hardware specifications required of an appliance through innovations from the

software to deliver optimal value to customers. The new version introduces a new

modular design, as show in the following picture:

Page 24: Features of SQL Server 2012.docx

The smallest PDW appliance consists of a Base Scale Unit (with a Passive Scale Unit for HA)

and can be extended by a number of Capacity Units. If you reach the physical space limit of

the rack you can add up to 6 more racks.

Depending of the vendor the units are shipped differently: HP offers a Base Scale Unit with 2

compute nodes and every Capacity Unit is also shipped with 2 compute nodes (left side of

the picture). Dell offers the Base Scale Unit and the Capacity Unit with 3 compute nodes

each (right side of the picture).

If we have a look at the capacity the smallest PDW appliance from HP (Quarter Rack with

only the Base Scale Unit) offers a capacity of 53 – 227 TB (depending on the compression

rates) and a raw disk space of 45 TB (with 3 TB disks). The Quarter Rack of DELL provides a

capacity of 79 – 3470 TB (depending on the compression rates) and a raw disk space of 68

TB (with 3 TB disks).

Further Scale: Based on the new modular hardware design and a hardware refresh

PDW offers now a scale out capacity up to 5 Petabytes.

SOFTWARE ARCHITECTURE OVERVIEW

Page 25: Features of SQL Server 2012.docx

The new version of PDW provides also some major software updates. As the product name

already states PDW is now running on SQL Server 2012. The operating system on all hosts is

Windows Server 2012 Standard edition. All fabric and workload activity happens in Hyper-V

virtual machines which also run on Windows Server 2012 Standard edition. A PDW Agent

runs on all hosts and all VMs and collects appliance health data on fabric and workload.

A special PDW version of SQL Server 2012 Enterprise Edition is used on the Control node and

on all Compute nodes to provide high scale database capabilities.

NEW FEATURES

Additionally to the new hardware and software architecture I want to highlight some more

very interesting features for customers:

Columnar Storage: Microsoft continues the rollout of xVelocity and provides with SQL

Server 2012 PDW a new primary storage type for databases. Customers can now choose

between a row store and a new updateable version of the xVelocity memory optimized

columnstore as table storage format. This means that we can define a writable Clustered

Columnstore Index (Updates and bulk load are fully supported) at a table so that the

whole table is stored into memory and we benefit of a much higher compression by the

column oriented storage format.

Page 26: Features of SQL Server 2012.docx

Visual Studio 2012 Integration: As you probably know the tool used for database

administration and database development in PDW Version 1 was Nexus. With the new

version of PDW we have now full support for SQL Server Data Tools for Visual Studio

2012.

   

Also the project types for SSIS, SSRS & SSAS are fully supported with Visual Studio 2012.

Monitoring Enhancements: The whole monitoring of sessions, queries, loads,

appliance health status and performance information has been completely redesign.

Microsoft did a very good job here and the design looks like the Azure Portal. This means

also for customers that monitoring and operations will look like the same On Premises as

well as in the Cloud on Windows Azure. The following screenshot gives an impression of

the new web user interface:

Polybase & Hadoop Integration: Today almost every big database vendor also

provide a “Big Data” solutions based on Hadoop. Whether it’s a vendor specific

Page 27: Features of SQL Server 2012.docx

distribution like IBM’s BigInsights solution, which is based on Cloudera or Microsoft’s

specific implementation of Hortonworks Hadoop distribution called HDInsight or a full

appliance which comes pre-installed with Hadoop. No matter which Hadoop platform

you choose you still have the challenge of integration. Some type of data and

analytics will happen on Hadoop (like text, log or sensor analysis) but we will still use

databases for BI & Reporting.

While this might be something you have decided to do, you realize that there is a big

learning curve when your IT department needs to re-orient themselves around HDFS,

MapReduce, Hive, Hbase, etc. rather than T-SQL and a standard RDBSMS design. It will

require a significant re-training around Hadoop and the ecosystem as well as a major effort

to integrate the Hadoop implementation with the data warehouse.

In order to meet the requirements of a modern data platform, it must provide insights to

your end users without having to acquire another tool from a third party or another

expensive appliance offering to purchase.

The unfortunate reality is that no one vendor can deliver on all the options you need at a

cost that you want to pay. They either have a data warehouse solution but no BI or provide

BI but no data warehousing. Some vendors provide a Big Data solution but is disconnected

with their data warehouse solution. Finally, some vendors might have a solution for each

workload and will happily charge you millions of euros or dollars for them all.

Microsoft goes a different way and brings with SQL Server

2012 PDW an integrated query layer called “Polybase”

which enables queries across Hadoop and SQL Server. Data

structures stored in Hadoop are described by tables in PDW

and customers can consume these data by standard T-SQL

and can also join those tables with normal relational ones.

So to end users that only consume this data it’s totally

transparent where the data comes from and IT departments

can use their normal database skillset to work with Hadoop.

How does those kind of tables look like?

Page 28: Features of SQL Server 2012.docx

Now we can easily query and join this table.

Polybase is developed by the PDW team together with the Gray System Laband its famous

team lead David DeWitt. More detailed information can be found on the project

page: http://gsl.azurewebsites.net/Projects/Polybase.aspx or in the video of the PASS 2012

conferencehttp://www.sqlpass.org/summit/2012/DavidDewittSpotlight.aspx

SUMMARY

As you can see from this post Microsoft did very heavy investments in its modern Big Data

platform and gives customers the possibility to invest build high scale solutions on SQL

Server 2012 PDW as well as on HDInsight for Hadoop based workloads. With Polybase

customers get a fully integrated Hadoop query engine into the Data Warehouse Layer that

can easily consumed with T-SQL knowledge.

The new architecture and the modular design of the appliance gives customers the

possibility to start with small investments and scale very cost efficient on demand.

In my next post I will talk in more detail about a POC I did with the new version and the

results and lessons learned.

Source: Microsoft slide decks of SQL Server 2012 Parallel Data Warehouse

Page 29: Features of SQL Server 2012.docx

Introducing Microsoft SQL Server 2012

Introduction

This article describes the exciting new versions and features of the recently released Microsoft SQL Server 2012.

Since the introduction of SQL Server 7.0, Microsoft continues to make giant leaps in data analytics, data mining, data

retrieval performance, and high-availability; thus, earning a significant spot in the Gartner quadrant for business

intelligence (BI) platforms.

SQL Server overtakes IBM DB2 and claims #2 spot for DBMS revenue.

Lowest total cost of ownership when compared to other DBMS vendors.

SQL Server reliably manages the data for the largest retail project of 8,000 stores.

PowerPivot was voted one of eWeek’s Top 10 technologies of 2010.

SQL Server delivers 99.9999% uptime availability.

This article will list and describe the editions, key features, and will review licensing.

 

Editions

SQL Server 2012 Enterprise (EE) Can utilize as many core processors and memory as are supported by the

host Windows Operating system (OS). Includes support for all of the advanced availability (“AlwaysOn”) and

advanced BI features. Includes advanced analysis features such as: PowerPivot, Power View,

Master Data Services, and advanced auditing. Includes new data management features such as: Transparent data

encryption and “ColumnStore” index. Licensed per core which is different compared to the SQL Server 2008. 

SQL Server 2012 Standard

Supports up to 16 core processors and up to 64GB of memory. Does not include support for any of the advanced features listed under

Enterprise. Licensed per core or server Support for two-node “AlwaysOn” failover 

 SQL Server 2012 Business Intelligence

A unique edition to SQL Server 2012. Supports up to 16 core processors and up to 64GB of memory. For SQL Server Analysis Services (SSAS) and SQL Server Reporting

Services (SSRS), this edition can use as many cores supported by the host Windows server OS.

Includes all of the BI features listed under Enterprise including: Power View and PowerPivot.

 

Page 30: Features of SQL Server 2012.docx

SQL Server 2012 Express and LocalDB

Free licensing Limited support for one processor and 1 GB of memory. Designed to work with lightweight client applications Runs as a user process and not as a Windows service. 

SQL Server 2012 Web and Developer

The Developer edition includes all of the features of EE Licensed per developer and as with previous versions, cannot be used to

support production installations. The Web edition is licensed to the web hosting firms with service provider

license agreements.Key Features

Just a few of the new features listed here:

AlwaysOn – It is often heard that IT department directors are interested in high availability, however they are reluctant to buy additional hardware to support SQL Server clustering and Database Mirroring does not allow for immediate use of mirrored databases. “AlwaysOn” failover eliminates the need for idle hardware and this feature allows for the utilization of a “Reporting” server to provide failover support for the Dynamics AX Online Transaction processing (OLTP) database. For more information, please refer to this link:http://www.microsoft.com/sqlserver/en/us/solutions-technologies/mission-critical-operations/SQL-Server-2012-high-

availability.aspx

 

Columnstore Index – A new type of index to greatly improve reporting performance. Creating a ColumnStore increases reporting efficiency by storing table columns commonly used in reports in a separate set of disk pages. When compared to storing several rows per page, this makes disk access much faster. For more information, please refer to this whitepaper:http://www.sqlserver-training.com/what-is-columnstore-index-in-sql-server/-

 

Database Recovery Simplified – Using the Database Recovery Advisor, a visual timeline can be viewed by the Database Administrator (DBA) which will show the backup history and helps the DBA identify which backups are required to get a database recovered to a specific point. For more information, please refer to this link:http://www.mssqltips.com/sqlservertip/2618/point-in-time-recovery-using-new-timeline-feature-in-sql-server-2012

 

PowerPivot - To download Microsoft SQL Server 2012 PowerPivot for Excel 2010, please refer to this link:http://www.microsoft.com/download/en/details.aspx?id=29074

Page 31: Features of SQL Server 2012.docx

 

Power View (SSRS)

Integrated with Microsoft SharePoint, Power View allows users to create and view powerful interactive reports using a

few clicks of the mouse. These graphics can easily be imported into PowerPoint to create highly effective business

presentations.

For more information, please refer to this link:

http://msdn.microsoft.com/en-us/library/hh213579.aspx

 

Licensing

There are still two SQL Server licensing options,

1) Based on the number of processors (Cores)

2) Based on the number of users (CALs).

The Enterprise and Standard Editions are based on the number of cores sold in two-core packs. However, the cost of

a core license has been significantly reduced compared to the SQL Server 2008 per processor licensing.

Microsoft has created a smooth transition to these new editions and licensing. Microsoft wants to enable customers to

be able to take advantage of the new features and performance advantages of SQL Server 2012 while at the same

time, help customers protect their investments.

For up-to-date licensing details, please refer to this link:

http://www.microsoft.com/sqlserver/en/us/get-sql-server/licensing.aspx

 

Conclusion

To learn more about the capabilities of SQL Server 2012, be sure to check out this article:

http://www.microsoft.com/sqlserver/en/us/product-info/why-sql-server.aspx

Please send me your questions and comments.

Upcoming articles:

How to manage SQL Server transaction log files. Tips on maximizing performance and scalability of Dynamics 2012. Dynamics AX 2012 support for telephony systems. Dynamics AX 2012 integration tools.