How do I find out what License has been applied to my SQL Server installation?
Asked Answered
H

7

35

I have SQL Server 2008 installed, but I'm not sure what license was installed. Is there an easy way to find this out?

Horseback answered 4/11, 2010 at 17:32 Comment(0)
T
26

This shows the licence type and number of licences:

SELECT SERVERPROPERTY('LicenseType'), SERVERPROPERTY('NumLicenses')
Triserial answered 5/11, 2010 at 11:47 Comment(5)
Just in case you happen upon this for SQL Server 2005: In SQL 2005 it does not set the license information so you will get "Disabled" and NULL for the above query.Pollen
@klabranche I just got Disabled and NULL on two SQL Server 2008 R2. Any ideas?Eyeball
Looks like this is the new normal... technet.microsoft.com/en-us/library/ms174396.aspx Not sure if there are other properties now to use....Pollen
same here with sql 2012 :) disabled and nullRecycle
disabled and null on SQL server enterprise 2017Demy
G
49

I presume you mean via SSMS?

For a SQL Server Instance:

SELECT SERVERPROPERTY('productversion'), 
       SERVERPROPERTY ('productlevel'), 
       SERVERPROPERTY ('edition')

For a SQL Server Installation:

Select @@Version

Gaskell answered 4/11, 2010 at 17:34 Comment(2)
@OMG - ah nice. Goes all the way back to 6.5! Does anyone still use that?!Gaskell
THanks for this, but I actually meant whether the Server has a 5 CAL license or a CPU license.Horseback
T
26

This shows the licence type and number of licences:

SELECT SERVERPROPERTY('LicenseType'), SERVERPROPERTY('NumLicenses')
Triserial answered 5/11, 2010 at 11:47 Comment(5)
Just in case you happen upon this for SQL Server 2005: In SQL 2005 it does not set the license information so you will get "Disabled" and NULL for the above query.Pollen
@klabranche I just got Disabled and NULL on two SQL Server 2008 R2. Any ideas?Eyeball
Looks like this is the new normal... technet.microsoft.com/en-us/library/ms174396.aspx Not sure if there are other properties now to use....Pollen
same here with sql 2012 :) disabled and nullRecycle
disabled and null on SQL server enterprise 2017Demy
L
26

I know this post is older, but haven't seen a solution that provides the actual information, so I want to share what I use for SQL Server 2012 and above. the link below leads to the screenshot showing the information.

First (so no time is wasted):

SQL Server 2000:
SELECT SERVERPROPERTY('LicenseType'), SERVERPROPERTY('NumLicenses')

SQL Server 2005+

The "SELECT SERVERPROPERTY('LicenseType'), SERVERPROPERTY('NumLicenses')" is not in use anymore. You can see more details on MSFT documentation: https://learn.microsoft.com/en-us/sql/t-sql/functions/serverproperty-transact-sql?view=sql-server-2017

SQL Server 2005 - 2008R2 you would have to:

Using PowerShell: https://www.ryadel.com/en/sql-server-retrieve-product-key-from-an-existing-installation/

Using TSQL (you would need to know the registry key path off hand): https://learn.microsoft.com/en-us/sql/relational-databases/system-dynamic-management-views/sys-dm-server-registry-transact-sql?view=sql-server-2017

SQL Server 2012+

Now, you can extract SQL Server Licensing information from the SQL Server Error Log, granted it may not be formatted the way you want, but the information is there and can be parsed, along with more descriptive information that you probably didn't expect.

EXEC sp_readerrorlog @p1 = 0
                    ,@p2 = 1
                    ,@p3 = N'licensing'

NOTE: I tried pasting the image directly, but since I am new at stakoverflow we have to follow the link below.

SQL Server License information via sp_readerrorlog

Legist answered 15/1, 2019 at 13:25 Comment(3)
Pretty solid update to an old, out of date question with a good amount of activity. I updated it to add your code from the link you posted.Rotatory
For SQL Server 2012, I had to search for 'copyright' instead of 'licensing' to get one of the two rows in the screenshot.Beggary
The Powershell link showed my Product Key for SQL Server 2008 R2, but got the Edition wrong.Natiha
I
22
SELECT SERVERPROPERTY('LicenseType') as Licensetype, 
       SERVERPROPERTY('NumLicenses') as LicenseNumber,
       SERVERPROPERTY('productversion') as Productverion, 
       SERVERPROPERTY ('productlevel')as ProductLevel, 
       SERVERPROPERTY ('edition') as SQLEdition,@@VERSION as SQLversion

I had installed evaluation edition.Refer screenshot enter image description here

Induplicate answered 26/8, 2017 at 7:32 Comment(0)
S
3

When I run:

   exec sp_readerrorlog @p1 = 0
   ,@p2 = 1
   ,@p3 = N'licensing'

I get:

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

also, SELECT @@VERSION shows:

Microsoft SQL Server 2014 (SP1-GDR) (KB4019091) - 12.0.4237.0 (X64) Jul 5 2017 22:03:42 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.3 (Build 9600: ) (Hypervisor)

This is a VM

Squatter answered 19/2, 2019 at 0:37 Comment(1)
I'm also getting the same kind of results on my SQL Server 2014 for the licensing query. Still looking for another why to find what is the licensing of my server :)Petua
A
2

SQL Server does not track licensing. Customers are responsible for tracking the assignment of licenses to servers, following the rules in the Licensing Guide.

Alcorn answered 23/7, 2020 at 19:4 Comment(0)
S
0

For those who are new to this page and using SQL Server, if you're using SQL Server 2019 or 2022, you can easily retrieve details such as the Product Edition, Product Version, and Product Level with the following query:

SELECT
 SERVERPROPERTY('Edition') AS Edition,
 SERVERPROPERTY('ProductVersion') AS ProductVersion,
 SERVERPROPERTY('ProductLevel') AS ProductLevel;

This query utilizes the 'SERVERPROPERTY' function to extract the specified properties, making it easy to view important versioning information directly from your SQL Server instance.

Subtitle answered 14/4, 2024 at 15:45 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.