If you have installed SQL server 2012 Enterprise Evaluation Edition, this trial software will expire after 180 days without any pre alert notification. This SQL query will show the current version and edition of SQL Server you are using.
SQL server 2012 has been introduced in three main licensed editions: Enterprise, Business intelligence and Standard. Microsoft has also released fully featured 180 days free trial SQL server 2012 Enterprise Evaluation Edition.
Considering all the various different versions and the potential of expiration of trial additions, detecting the expiry date is a neat weapon to have.
The succeeding query will show the version and edition of SQL server you are presently using.
SELECT 'SQL_Server_Edition' AS 'Verion', SERVERPROPERTY('Edition') AS Type_Of_Edition
UNION
SELECT 'Version', @@VERSION
The following query will list the installed date, expiry date, number of days used, and number of days left to use SQL server 2012 evaluation edition.
SELECT create_date AS 'SQL Server Installed Date',
Expiry_date AS 'SQL Server Expiry Date',
DATEDIFF(dd,create_date, GETDATE()) 'No_of_Days_Used',
ABS(DATEDIFF(dd,expiry_date,GETDATE())) 'No_Of_Days_Left'
FROM
(SELECT sp.create_date,
DATEADD(dd, 180, sp.create_date) AS Expiry_date
FROM sys.server_principals sp
WHERE sp.name = 'NT AUTHORITY\SYSTEM') as exp_date_tbs
Results are shows in yyyy-mm-dd format.
The above query uses the system internal table sys.server_principals to determine the sp.create_date (sql server installed date) based on the where condition which is filtering on name ‘NT AUTHORITY\SYSTEM’ service which gets installed while installing SQL server 2012 for the first time.
After using SQL server 2012 enterprise evaluation edition for 180 days you may receive ‘SQL server 2012 evaluation period has expired’ error. To fix this issue you need to obtain a valid license product key which you can buy from Microsoft official site.