How to find operating system (OS) that SQL Server runs on

This query returns information on operating system SQL Server database runs on.

Query

select host_platform as os_type,
       host_distribution as os,
       host_release as version
from sys.dm_os_host_info;

Columns

  • os_type - type of operating system: Windows or Linux
  • os - operating system description
  • version - version of operating system. For windows check list of values to find out version of OS.

Windows values

Value OS Version
10.0* Windows 10, Windows Server 2019, Windows Server 2016
6.3* Windows 8.1, Windows Server 2012 R2
6.2 Windows 8, Windows Server 2012
6.1 Windows 7, Windows Server 2008 R2
6.0 Windows Server 2008, Windows Vista
5.2 Windows Server 2003 R2, Windows Server 2003, Windows XP 64-Bit Edition
5.1 Windows XP
5.0 Windows 2000

Rows

Query returns just one row

Sample results