I use an SQL statement to get the underlying OS and OS version of my SQL Server 2019.
This works fine for all versions of Windows ... except Windows 11.
SELECT @@VERSION AS OS
results on a fresh Windows 11 machine (Windows 11 Enterprise - Build 22000.469) in the string
Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64)
Sep 24 2019 13:48:23 Copyright (C) 2019 Microsoft Corporation
Enterprise Edition: Core-based Licensing (64-bit) on Windows 10 Enterprise 10.0 <X64> (Build 22000: ) (Hypervisor)
Is this a bug? Or what's going on here?
And how can I get information to distinct Windows 10 from Windows 11? Do I have to parse the build number and interpret build numbers >= 22000 as Windows 11?
CodePudding user response:
Is this a bug? Or what's going on here?
SQL Server 2019 does not know how to tell the difference between Windows 10 and Windows 11 because Windows decided not to increment the "major" component of the build number for the release. It's 10.0.22000.
This is closely related to the reason SQL Server works perfectly on Windows 11. Windows no longer introduces breaking changes. And it's long been the policy of SQL Server to support new versions of Windows for supported versions of SQL Server on release. The support matrix in the docs sometimes lags, but you can generally open a support case for SQL Server on the latest version of Windows.
Perhaps a future release will implement the logic to differentiate between Windows 10 and Windows 11.
CodePudding user response:
There is a DMV for it.
Check it out.
SQL
SELECT * FROM sys.dm_os_host_info;
Output
--------------- -------------------------------- -------------- ------------------------- ---------- --------------------- -------------------
| host_platform | host_distribution | host_release | host_service_pack_level | host_sku | os_language_version | host_architecture |
--------------- -------------------------------- -------------- ------------------------- ---------- --------------------- -------------------
| Windows | Windows Server 2019 Datacenter | 10.0 | | 8 | 1033 | X64 |
--------------- -------------------------------- -------------- ------------------------- ---------- --------------------- -------------------
