sys.dm_os_host_info (Transact-SQL)

Applies to: SQL Server 2017 (14.x) and later

Returns one row that displays operating system version information.

Column name Data type Description
host_platform nvarchar(256) The type of operating system: Windows or Linux
host_distribution nvarchar(256) Description of the operating system.
host_release nvarchar(256) Microsoft Windows operating system release (version number). For a list of values and descriptions, see Operating System Version (Windows).
For Linux, returns an empty string.
host_service_pack_level nvarchar(256) Service pack level of the Windows operating system.
For Linux, returns an empty string.
host_sku int Windows Stock Keeping Unit (SKU) ID. For a list of SKU IDs and descriptions, see GetProductInfo Function. Is nullable.
For Linux, returns NULL.
os_language_version int Windows locale identifier (LCID) of the operating system. For a list of LCID values and descriptions, see Locale IDs Assigned by Microsoft. Cannot be null.

Remarks

This view is similar to sys.dm_os_windows_info, adding columns to differentiate Windows and Linux.

Security

Permissions

The SELECT permission on sys.dm_os_host_info is granted to the public role by default. If revoked, requires VIEW SERVER STATE permission on the server.

Caution

Beginning with version SQL Server 2017 (14.x) CTP 1.3, SQL Server Management Studio version 17 requires SELECT permission on sys.dm_os_host_info in order to connect to SQL Server. If SELECT permission is revoked from public, only logins with VIEW SERVER STATE permission can connect with the newest version of SSMS. (Other tools, such as sqlcmd.exe can connect without SELECT permission on sys.dm_os_host_info.)

Permissions for SQL Server 2022 and later

Requires VIEW SERVER PERFORMANCE STATE permission on the server.

Examples

The following example returns all columns from the sys.dm_os_host_info view.

SELECT host_platform, host_distribution, host_release, 
    host_service_pack_level, host_sku, os_language_version  
FROM sys.dm_os_host_info;  

Here is a sample result set on Windows:

host_platform host_distribution host_release host_service_pack_level host_sku os_language_version
Windows Windows Server 2012 R2 Standard 6.3 7 1033

Here is a sample result set on Linux:

host_platform host_distribution host_release host_service_pack_level host_sku os_language_version
Linux Ubuntu 16.04 NULL 1033

See also

sys.dm_os_sys_info (Transact-SQL)
sys.dm_os_windows_info (Transact-SQL)