Many of us are used to using @@version to get the version of SQL Server we are using. This also works when you are utilizing an Azure SQL database, although the results are slightly different. However, before getting to @@version, I would like to go over a few other methods to obtain version information.
How to Get Version
There are many reasons why it is important to know the version of a SQL Server. The reasons include everything from licensing to upgrades. In this section, I will cover a few of the common methods used to get the version of SQL Server.
With an on-prem instance of SQL Server one method that can be used to get the version is to right click on the server in SQL Server Management Studio. Once you do, you can click on the properties menu item and the window below will appear. As you can see, in the boxes you are able to see both the version and edition of the SQL Server.

However, when you attempt to do this in an instance of Azure SQL database, the properties menu item is not available. Below is what you will see when you right click on the instance of an Azure SQL database in SQL Server Management Studio.
Another method to get the version of SQL Server is to utilize the SERVERPROPERTY function. The SERVERPROPERTY function can be used to view server level properties, in this case the product version.
SELECT SERVERPROPERTY(‘ProductVersion’);
When you execute the above statement you will then see the version. It will look like the number below. The number represents the version, in this case, SQL Server 2017.
14.0.1000.169
As mentioned above, the ServerProperty function can be used to return a number of bits of information about the server. Here is a link for more detailed information, click here.
The final method I would like to talk about is using @@version. This is a global variable in SQL Server that will return not only the version of SQL Server, but also the OS version.
When reading from this global variable, you include it in a SELECT statement as illustrated below.
SELECT @@Version
The results will vary from an on-prem instance of SQL Server to an Azure SQL Database.
This is what you will see for an on-prem instance.
Here is the complete text of the results.
“Microsoft SQL Server 2017 (RTM) – 14.0.1000.169 (X64) Aug 22 2017 17:04:49 Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Home 10.0 <X64> (Build 17134: ) “
As you can see it returns some good information. Including the version of SQL Server, the service pack status, 32-bit or 64-bit and the OS version.
However, the results change quite a bit when this is ran against and Azure SQL database.
The complete text is just as you see it above. Notice the lack of OS version.
What is next?
Now that we have covered a number of ways to get the version information, let’s take a look at some of the differences from an on-prem instance to an Azure SQL database.
When looking at the results, it is easy to identify an instance as an Azure instance in just in the first few words, it clearly states that it is an Azure instance, it is indeed in Azure.
If you look at the results below you will see that I used both @@version and ServerProperty to get the information I am looking for. You will also notice that I included a simple query using the sys.databases object. This will return the compatibility level for each database, which as you will see is going to be important.

Looking above you will see that it is an Azure instance, has a product version of 12.0.2000.8 and both databases have a compatibility level of 140. The compatibility level of 140 is SQL Server 2017.
What….12.0? Isn’t that SQL Server 2014? If you said yes, you are correct. Is it really possible that Azure SQL Database is SQL Server 2014? The answer is no. That number is different that an on-prem instance of SQL Server. According to what I have ready, version 12.0 is the most current version. Given both the Azure instance and the SQL Server 2014 both of a product version of 12.0, it now comes down to the compatibility level for the databases for Azure.
As you can see both databases of a compatibility level of 140, which is SQL Server 2017, not 2014. Since I didn’t change this when I created the databases, this tells me that the instance of Azure SQL Database was on SQL Server 2017 when I created the database. As with an on-prem instance of SQL Server, the compatibility level for an Azure SQL database can be changed. When I created a new Azure SQL Database, the compatibility level was 140, which is SQL Server 2017.
To change the compatibility level of a database you have to run an Alter Database command.
ALTER DATABASE Advent
SET COMPATIBILITY_LEVEL = 160
When I ran the above code, I got an error.
Msg 15048, Level 16, State 1, Line 1
Valid values of the database compatibility level are 100, 110, 120, 130, 140 or 150.
Notice it states that 150 is an option, while 160 is not. Compatibility level of 150 is SQL Server 2019, the latest version. It looks like the available options go back quite a bit, version 100, which is SQL Server 2008.
Since in Azure SQL Database, the version of the database is key when investigating versions, below you will find the code to retrieve the versions of all databases.
SELECT name, compatibility_level FROM sys.databases;
All the above code, works on both an Azure SQL database and an on-prem SQL Server.

Notice that the Advent database has a compatibility level of 150, SQL Server 2019. When investigating version information, it important to also review the compatibility level of the database you are looking at as well as the server version.
Thanks for stopping by, I hope you learned something.





Metric Namespace: This is the group of metrics that you are looking for. The items in the drop down box changes depending on the type of resource selected. Since I am working with a storage account, you see the account option. If you don’t see this for some reason, click the “Add Metric” link that can be found just under the Chart Tile.
Although this example is a line chart, you can change the chart type easily. Just click the arrow to the right of where it says “Line chart” in the upper right corner.
Just like in Excel, there are a number of options for chart types, just not as many options. Only 5 options here. Just like in any other reporting tool, not all charts work well with all data sets.



Once you click the menu item, the settings window opens. Here you can change only Y value. Remember the X values are determined by the date range mentioned earlier.








When you do, you will be taken to the administration page for the database. On the left side you will see the “Query editor” link. You will also notice that this is a feature that is still considered to be in preview.
When I did a Google search on the Query editor in the Azure portal, I found posts from as far back as 2017. Despite that, I still wanted to complete a blog post on it. Once you click it, you will be taken to a login page similar to below.
Notice on the right side there is the ability to utilize the Active Directory single sign on functionality, which I do not have. On the left you will enter the appropriate credentials to login to the database.






One option that is important to me is the ability to change the font size. I have NOT found out how to do this in Azure Query editor.
Once you have your query as you like, all you have to do it click the Run button






Once you click “Next” you will then be asked to identify a source. Since this post is about migrating an on-prem SQL Server database to Azure SQL Database, the source will be a local instance of SQL Server. You will have to provide an authentication method and then the database(s) you would like to complete the assessment on. Once you have provided all the information you can click the “Start Assessment” button.


Selecting a source if the obvious starting point for a migration. Once you do, you will then have an opportunity to pick which database you would like to migrate.
When you do, make sure you click the Connect button so the list of databases refreshes.
In this case there are still a few issues that will need to be address, most due to encryption, so I will not migrate those objects. The next step is to generate the scripts. Once the scripts are generated, you can save it or copy it. Note below you the DMA tool will also identify items with assessment issues.







Also, if you chose Online Data Migration, it will require a higher level of SKU. You must have Premium, which I currently do not have. I received this warning what I tried to use Online Data Migration.
Given this I changed the type of activity to Offline Data Migration. You will have to complete several steps to be successful in the migration. These steps are fairly basic and expected. Identify a source, a target, map to target database, configure migration options and a summary.
There are a number of network and security steps that must be completed prior to utilizing this service. This is a good description of what is required, 






Before we move on, I would also like to point out that there are several methods to reach this page. Most notably is by using the menu item on the left. Then you will need to create the database, you can click the “SQL Databases” option. This will take you to the part of the portal that will allow you to create a database, as you see in the image above.

You also have the ability to change the columns that you see in the list. You simple click “Edit Columns”. You can also click “Refresh” to see new items if they do not appear.




If you violate one of the rules, Azure will tell you. Just as seen below.
Now that we have provided a name for the database, the next step is to assign it to a server.
If you have not created a server yet, you can simply click the “Create New” link. A server for Azure SQL Database is a logical container for your SQL Databases and provides a centralized point for administration. Here is a link to Microsoft’s
Once you have click the “Select” button and filled out all the information, it may look like you are done, but you are not. We need to provide additional information. By clicking on the “Additional Setting” item towards the bottom we will see the what else we need to provide.
The first item we need to address is the Data Source. Here you have three options.
The rest of the options are pretty straight forward, however should be carefully be reviewed before creating the database.
Once the deployment is complete, Azure will tell you as seen below.
Notice that our new database is listed.
If you click the drop down arrow you will see this and the tags that was created. By clicking the box next to Adventwork, the list will only show items that have a tag of Adventwork.
Connecting to the Database
Once on the clipboard, it is time to open SSMS. You will connect just as if you were connecting to an On-Prem SQL Server using SQL Authentication.
Once you enter a user name and password, you click Connect. This is where you will begin to see a few differences. You will be asked to login into your Azure account as well as a few screens about your IP address.
Listing all the differences is outside the purpose of the post, however there is a lot of really good information available. I may cover some of these differences in future blog posts. Once you are in SSMS, you can do many of the same things you have done with an on-prem instance. Including creating objects, writing queries and working with security. Please keep in mind that there are some differences on how security is set up, however that is for another time.