Azure SQL Database – Version and Compatibility Level

In the on-premises world, when we install a SQL Server on our own servers, we decide on SQL Version (2012, 2014….), Edition (Standard, Enterprise, Epress…) and we set the database Compatibility Levels according to our applications’ specs. But what is it like with the Azure SQL Database (PaaS)? The answer is – it’s very different so let’s go through the key points to have in mind:

SQL Version

Azure SQL Database has it’s own versioning schema so the current version is called “V12”. Unlike with the boxed product, SQL Database feature set is constantly expanding in short release cycles. New features are first made available to a small group of users in so-called “private preview mode”, then they are rolled into “public preview mode” during which they can be changed at any time and then, few months later, they become “generally available”.

At the infrastructure level, not visible to users, SQL Database as a service (PaaS) is hosted on latest SQL Server builds so the feature set of V12 is very similar to that of the current SQL version the addition of any new features.

For example, one of cool new features in SQL 2016 known as Query Store was made available in SQL Database long months before SQL 2016 release.

Because Azure databases are hosted on latest builds and because oof all those new features, end users should always update the SQL Server Management Studio (SSMS) instead of using old versions.

The difference between the boxed SQL and PaaS databases is also visible in build numbers. For on-premises instances, SQL 2014 build numbers start with 12, SQL 2016 with 13 and so on, but with the Azure SQL Database things are little different. See this screenshot:

AzureNov29

12? Does that mean that my Azure SQL database is hosted on SQL 2014 RTM ?

Ehm… no. That means that the SQL Azure builds are displayed differently. The version of Azure SQL Database is a combination of edition and ProjectMayorVersion.  ( select SERVERPROPERTY(‘edition’), select SERVERPROPERTY(‘ProductMajorVersion’). The ProjectMayorVersion shows 12 which corresponds to the name “V12” for the current Azure SQL DB version.

SELECT
SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('ProductLevel') AS ProductLevel,
SERVERPROPERTY('Edition') AS Edition,
SERVERPROPERTY('EngineEdition') AS EngineEdition,
SERVERPROPERTY('edition') AS Edition,
SERVERPROPERTY('ProductMajorVersion') As MayorVersion,
@@version AS version;
GO

Porduces:

ProductVersion: 12.0.2000.8
ProductLevel: RTM
Edition: SQL Azure
EngineEdition: 5
Edition: SQL Azure,
MayorVersion:12
version: Microsoft SQL Azure (RTM) – 12.0.2000.8 Aug 17 2017 03:51:24 Copyright (C) 2017 Microsoft Corporation. All rights reserved.

Compatibility Level

The compatibility level of V12 is 120, which was introduced with SQL 2014. And while the boxed product supports 3 different compatibility levels – one current and two previous ones,  Azure SQL Database currently supports 4: 100, 110, 120 and 130. This is important to have in mind when we migrate legacy applications, especially if we have 3rd party products that that we can’t modify. Details on 120 features and differences to earlier versions are described at this URL: https://msdn.microsoft.com/en-us/library/bb510680.aspx Here’s just one example with date functions:

SET DATEFORMAT dmy;

DECLARE @t2 date = '12/5/2011' ;

SET LANGUAGE dutch;

SELECT CONVERT(varchar(11), @t2, 106);
-- Results when the compatibility level is less than 120: 12 May 2011
-- Results when the compatibility level is set to 120: 12 mei 2011

If you want to change the compatibility level, you will have to do that programmatically because there’s no Properties dialog for Azure SQL Databases that would allow changing database settings through GUI. Here’s the ALTER DATABASE statement for that:

ALTER DATABASE DemoDB
SET COMPATIBILITY_LEVEL = 110

SQL Server Editions

The pricing model has changed with SQL PaaS , there are no Editions with different feature sets and pricing and we don’t have to pay millions for Enterprise Edition upfront just because of a single cool feature while we’ll never need 99% of all others. Instead of Editions there are now Service Tiers that have identical feature sets but with different performance levels and, of course, prices. There’s no upfront cost anymore, billing is per hour and we only pay for what we really use (more on that here). This allow us to start with the smallest/cheapest database, test any features we want, scale it up and down, and then drop it when we’re done.

Advertisements

7 thoughts on “Azure SQL Database – Version and Compatibility Level

  1. Hi, do you know how long Microsoft will give you to upgrade to the latest version once a new version comes out of Azure SQL? Are you forced to upgrade from, for example, V11 to V12 or can you stay on an older version ?

    Liked by 1 person

  2. If my DB is hosted on a SQL 2014 RTM, then how could it possibly support compatibility level of 130 ? Isn’t 130 meant for SQL 2016 ? Then how do I get all the 2016 features (JSON support etc.) on my Azure DB which is marked as V12 but still hosted on SQL 2014 ?

    Like

    • Hi Progmars,

      V12 is a feature sets that’s being continuosly expanded. I’m pretty sure that SQL Server builds hosting Azure SQL Databases are not same as the boxed products, otherwise we wouldn’t have new features like JSON, DDM or RLS way ahead of SQL 2016 release.

      Like

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