Check SQL Server license in SQL Server

Spread the love

As a SQL Server DBA, I would rephrase the statement as follows:

While SQL Server does not keep track of license information, it can provide you with details about the installed edition and version. To ensure proper licensing, it is recommended that you contact Microsoft with the product ID. They can assist you in determining the number of licensed instances, cores, clients, and other relevant details. Additionally, they can clarify the licensing terms and help you achieve compliance. Ref.

Check Version or Edition of SQL Server

This blog provides three methods for determining a SQL Server instance license and identifying the installed edition or version on your system.

1: Check SQL Server Version Using SSMS

To use this method, launch SQL Server Management Studio (SSMS) and connect to your SQL Server database. In Object Explorer, locate the server and right-click on it. From the drop-down menu, select Properties.

2: Check SQL Server Version Using SQL Server Installation Center

To use this method, click on the Start button and locate the SQL Server folder. Within this folder, launch the SQL Server Installation Center.

Tools > Installed SQL Server features discovery report

3: Check SQL Server Version Using T-SQL

To begin, open SSMS and connect to your SQL Server instance by executing the following command:

4. We can also extract licensing information from the SQL Server Error Log.

SQL Server detected 1 sockets with 2 cores per socket and 4 logical processors per socket, 4 total logical processors; using 4 logical processors based on SQL Server licensing. This is an informational message; no user action is required.

In this below T-SQL script retrieves server information about the current SQL Server instance, including the server name, edition, logical CPU count, sockets, cores per socket, and the number of licenses required for the current edition of SQL Server.

The script uses system functions to retrieve server properties, including the @@SERVERNAME function to retrieve the server name, and the SERVERPROPERTY function to retrieve the edition of the SQL Server instance.

The script also uses the dm_os_sys_info dynamic management view to retrieve information about the server hardware, including the number of logical CPUs and hyperthreading ratio.

The CASE statement in the script evaluates the edition and hardware information to determine the number of licenses required for the current SQL Server edition. The number of licenses required varies based on the edition and the number of logical CPUs and sockets available on the server.

For example, the script determines that the Developer Edition, Express Edition, and Express Edition with Advanced Services require 0 licenses. Standard and Enterprise Editions require 2 licenses for servers with less than 4 cores. The script also checks the number of sockets and cores available on the server, and limits the licenses accordingly.

Finally, the script returns the server name, edition, logical CPU count, sockets, cores per socket, and the number of licenses required for the current edition of SQL Server.

Spread the love
Author: OTi
Meet OTi, the brains behind the popular tech blog "" OTi is an accomplished author, tech enthusiast, and an expert in SQL Server. With over a decade of experience in the tech industry, he has become a trusted voice in the world of database management. OTi's passion for technology began at a young age, and he has been tinkering with computers ever since. He graduated with a degree in Computer Science and has since worked for some of the biggest tech companies in the world. His experience has given him a deep understanding of how technology works and how it can be used to improve our lives.

Leave a Reply

Your email address will not be published. Required fields are marked *