About SQL Server Versions

203 views 09:41 0 Comments 10 September 2019

Introduction

I always very much confused about SQL Server Versions. To check the SQL Server version by TSQL we may run below script.

Script 01

SELECT @@VERSION AS 'SQL Server Version',
SERVERPROPERTY ('productlevel') as Product Level

Result

SQL Server Version : Microsoft SQL Server 2016 (SP2) (KB4052908) – 13.0.5026.0 (X64) Mar 18 2018 09:11:49 Copyright (c) Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2016 Standard 10.0 <X64> (Build 14393: )
ProductLevel: SP2

Script 02

xp_msver

Result

Script 03

SELECT
    -- Retrieve the SQL Server product version
    SERVERPROPERTY('productversion') AS ProductVersion,
    -- Retrieve the SQL Server product level
    SERVERPROPERTY('productlevel') AS ProductLevel,
    -- Retrieve the SQL Server edition
    SERVERPROPERTY('edition') AS Edition,
    -- Retrieve the machine name where SQL Server is running
    SERVERPROPERTY('MachineName') AS MachineName,
    -- Retrieve the license type of SQL Server
    SERVERPROPERTY('LicenseType') AS LicenseType,
    -- Retrieve the number of SQL Server licenses
    SERVERPROPERTY('NumLicenses') AS LicensesNum,
    -- Calculate the expiration date as 180 days after the SQL Server instance creation date
    DATEADD(DAY, 180, create_date) AS ExpirationDate,
    -- Retrieve the SQL Server installation date
    create_date AS SqlServerInstallationDate
FROM sys.server_principals
WHERE name = 'NT AUTHORITY\SYSTEM';

Result

Leave a Reply

Your email address will not be published. Required fields are marked *