How to check SQL Server version

Queries below return server version, edition and system information.

Query 1 - Raw

Query

select @@version as version

Columns

  • version - string containing SQL Server version and system information

Rows

Query returns just one row

Sample results

SQL Server 2017:

SQL Server 2012:

SQL Server 2008:

Query 2 - Formatted

Query

SELECT 
    case when CONVERT(sysname, SERVERPROPERTY('ProductVersion')) 
            like '8.0%' then 'SQL Server 2000'
        when CONVERT(sysname, SERVERPROPERTY('ProductVersion')) 
            like '9.0%' then 'SQL Server 2005'
        when CONVERT(sysname, SERVERPROPERTY('ProductVersion')) 
            like '10.0%' then 'SQL Server 2008'
        when CONVERT(sysname, SERVERPROPERTY('ProductVersion')) 
            like '10.5%' then 'SQL Server 2008 R2'
        when CONVERT(sysname, SERVERPROPERTY('ProductVersion')) 
            like '11.0%' then 'SQL Server 2012'
        when CONVERT(sysname, SERVERPROPERTY('ProductVersion')) 
            like '12.0%' then 'SQL Server 2014'
        when CONVERT(sysname, SERVERPROPERTY('ProductVersion')) 
            like '13.0%' then 'SQL Server 2016'
        when CONVERT(sysname, SERVERPROPERTY('ProductVersion')) 
            like '14.0%' then 'SQL Server 2017'
        when CONVERT(sysname, SERVERPROPERTY('ProductVersion')) 
            >  '14.0.9' then 'newer than SQL Server 2017'
        else 'unknown'
    end as [version],
    SERVERPROPERTY('Edition') as [edition]

Columns

  • version - SQL Server version, e.g. SQL Server 2017
  • edition - SQL Server edition, e.g. Standard Edition

Rows

Query returns just one row

Sample results

SSMS

You can check find information in SSMS by the server address in Object Explorer.

This is major.minor version numbers. You can translate them to version names with this table:

Version no Version name
8.0 2000
9.0 2005
10.0 2008
10.5 2008 R2
11.0 2012
12.0 2014
13.0 2016
14.0 2017