SQL Query to get product and version details of installed SQL Server

Not a long post but very handy query that can be used when you need to know the installed SQL Server product's version, edition, flavour, server name details.

SQL Query to get version details for installed Microsoft SQL Server:

SELECT
    SERVERPROPERTY('productversion') AS 'Product Version',
    SERVERPROPERTY ('productlevel') AS 'Product Level',
    SERVERPROPERTY ('edition') AS 'Product Edition',
    @@SERVERNAME AS 'Server Name',
    SUBSTRING(@@VERSION, 1, CHARINDEX('-', @@VERSION) - 1)
        + CONVERT(VARCHAR(100), SERVERPROPERTY('edition'))
        + ' '
        + CONVERT(VARCHAR(100), SERVERPROPERTY('productlevel'))
    AS 'Server Version';

Following query shows below output on my test machine:

SQL Query output for get product and version details of installed SQL Server

Happy coding !!

Show Comments