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. Can be 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).

On Linux, this column returns an empty string.
host_service_pack_level nvarchar(256) Service pack level of the Windows operating system.

On Linux, this column 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.

On Linux, this column 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. Can't be NULL.

Remarks

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

Security

Permissions

On SQL Server 2019 (15.x) and earlier versions, the SELECT permission on sys.dm_os_host_info is granted to the public role by default. If revoked, you require VIEW SERVER STATE permission on the server.

On SQL Server 2022 (16.x) and later versions, you require 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 Server 2019 Standard:

host_platform host_distribution host_release host_service_pack_level host_sku os_language_version
Windows Windows Server 2019 Standard 10.0 7 1033

Here is a sample result set on Ubuntu Linux 22.04:

host_platform host_distribution host_release host_service_pack_level host_sku os_language_version
Linux Ubuntu 22.04 NULL 1033