2

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?

4
  • 3
    I am surprised you got that installed at all. SQL Server Enterprise edition isn't supported on Windows 11 (regardless of the version). Operating system support Commented Feb 4, 2022 at 15:32
  • Microsoft has never been good with version numbers - you should try figuring out the installed versions of .NET Framework sometime. Windows 11 is still version 10, build 22000 (and later). Commented Feb 4, 2022 at 15:35
  • Successive versions of windows have taken to lying with older API calls to discover version information because other programmers (probably both others within MS and third parties) keep churning out more and more code that makes hard coded decisions based on returned values, ignoring that any future version will ever exist. Commented Feb 4, 2022 at 15:35
  • What info do you get from select * from sys.dm_os_host_info Commented Feb 4, 2022 at 16:47

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

2 Comments

"The support matrix in the docs will be updated eventually" The matrix is updated. All editions of SQL Server 2019 apart from Enterprise are supported on Windows 11. Enterprise isn't supported on Windows 10 either; never has been.
Yeah, it's not supported to use Windows 10/11 as a server, so running EE is discouraged.
0

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               |
+---------------+--------------------------------+--------------+-------------------------+----------+---------------------+-------------------+

1 Comment

This DMV will not tell you if you're on Win 11 for the reasons given in the accepted answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.