| title | sys.dm_os_host_info (Transact-SQL) | ||||
|---|---|---|---|---|---|
| description | The sys.dm_os_host_info DMV returns one row that displays operating system version information. | ||||
| author | rwestMSFT | ||||
| ms.author | randolphwest | ||||
| ms.date | 03/31/2025 | ||||
| ms.service | sql | ||||
| ms.subservice | system-objects | ||||
| ms.topic | conceptual | ||||
| f1_keywords |
|
||||
| helpviewer_keywords |
|
||||
| dev_langs |
|
||||
| monikerRange | >=sql-server-2017 || >=sql-server-linux-2017 || =azuresqldb-mi-current |
[!INCLUDE SQL Server 2017]
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) | [!INCLUDE msCoName] 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. |
This view is similar to sys.dm_os_windows_info, adding columns to differentiate Windows and Linux.
On [!INCLUDE sssql19-md] 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 [!INCLUDE sssql22-md] and later versions, you require VIEW SERVER PERFORMANCE STATE permission on the server.
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 |