SQL Server evaluation license expiration date

Published:

Running the following SQL should give you how many days left until your evaluation license runs out. Also tried adding a calculation of when that date is. Either way, beware of off-by-one errors...

sp_configure 'show advanced options', 1;
RECONFIGURE
GO

sp_configure 'Agent XPs', 1;
RECONFIGURE
GO

DECLARE @daysleft INT
DECLARE @instancename sysname
SELECT @instancename = CONVERT(sysname, SERVERPROPERTY('InstanceName'))
EXEC @daysleft = xp_qv '2715127595', @instancename
SELECT
    DATEADD(dd, @daysleft, CONVERT(DATE, getdate())) 'Expiration date',
    @daysleft 'Days left'
GO