问题
I have SQL Server 2008 installed, but I'm not sure what license was installed. Is there an easy way to find this out?
回答1:
This shows the licence type and number of licences:
SELECT SERVERPROPERTY('LicenseType'), SERVERPROPERTY('NumLicenses')
回答2:
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
回答3:
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://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 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
回答4:
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
回答5:
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
回答6:
SQL Server does not track licensing. Customers are responsible for tracking the assignment of licenses to servers, following the rules in the Licensing Guide.
来源:https://stackoverflow.com/questions/4099453/how-do-i-find-out-what-license-has-been-applied-to-my-sql-server-installation