Skip to content

Instantly share code, notes, and snippets.

@JayHollingum
Last active April 22, 2022 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayHollingum/907583bfb4238d5285c89202281af467 to your computer and use it in GitHub Desktop.
Save JayHollingum/907583bfb4238d5285c89202281af467 to your computer and use it in GitHub Desktop.
Get the version, edition, and expiry data if evaluation for SQL Server
select
SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('ProductLevel') AS ProductLevel,
SERVERPROPERTY('Edition') AS Edition,
create_date AS 'SQLServerInstallDate',
case
when CAST(SERVERPROPERTY('Edition') as nvarchar(100)) like '% evaluation %' then
DATEADD(day, 180, create_date) --evaluation periods for 180 days
else
''
end as 'SQLServerEvaluationEpireDate'
from
sys.server_principals
where
name = 'NT AUTHORITY\SYSTEM' --this account created at install time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment