13

I understand that there are three kinds of SQL licenses: http://www.microsoft.com/sqlserver/2005/en/us/pricing-licensing-faq.aspx

Is there a a dialog in SSMS, a sproc, registry key, etc I can look at on a server to determine the type and number of licenses?

Thanks

Booji Boy
  • 295

4 Answers4

9

Found this entry, which recommends to run this, in Query Analyzer:

select serverproperty('LicenseType'),serverproperty('NumLicenses')

"If the above query returns DISABLED then locate this "sqlslic.cpl" file in SQL server folder(C:\Program Files\Microsoft SQL Server\80\Tools\Binn), Right Click-> Open with Control Panel. this will show you the licensing type used"

Also:

"DISABLED usually means you are using an MSDN copy of SQL Server (so, not a production license - MSDN licenses are meant for development and testing)."

6

Per https://msdn.microsoft.com/en-us/library/ms174396.aspx:

LicenseType is Unused. License information is not preserved or maintained by the SQL Server product. Always returns DISABLED.

This is true for 2005+, so it does NOT mean that you are using an unlicensed version, contrary to the previous answer.

VoteCoffee
  • 175
  • 1
  • 4
4

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 (let's break it down):

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://docs.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://docs.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 sys.sp_readerrorlog @p1=0, @p2=1, @p3=N'licens'

Example output:

Example output from sys.sp_readerrorlog

Alex R
  • 1,093
Josean
  • 141
1

I know the question is old, and some of the answers are quite old, but this question popped up at the top of my google search today, so I wanted to make sure the correct information was here for the next guy. I also wanted to post this as a comment but lack the necessary 50 reputation.

There is no way to get your license information from the server that I have found after SQL 2000. And I've looked - hard.

You can find 'what should be licensed'* by running:

select @@version

The expected output is shown in Josean's answer. But note that is VERSION information not License information. It tells you what licenses you SHOULD have, and even that it does imperfectly. For example:

  1. If it returns Enterprise Edition and says it's using x cores - then you should have purchased x cores of Enterprise Edition licensing. These are not tied to the installation and the installation still works if you never bought a license - you just have an unlicensed version.
  2. There are two ways to license SQL - by the core, or with a server plus cal license - there is no way I have found to distinguish which a specific server is licensed with. There's meant to be a 'per seat' under properties supposedly, but I've never seen it.
  3. There is also software assurance which can change licensing requirements if you move up versions or have high Availability or Disaster Recovery in place.
  4. And then there's virtualisation, which nearly ever server is now. With SQL you can license a host server with enterprise and then whatever happens at the guest level is just smoke and mirrors.

Point is - licenses are maintained by your licensing vendor. Matching your licenses to the actual installations of SQL you have is your responsibility, not something that is in any way enforced by the software. It's technically quite possible to run a whole bunch of SQL instances without ever buying a license. It's also illegal and a nice way to set yourself up with a big bill.

RPD
  • 11