Get Windows OS version using t-sql

15 May,2019 by Jack Vamvas

Method 1 : Query sys.dm_os_windows 

 

SELECT windows_release, windows_service_pack_level, windows_sku, os_language_version  
FROM sys.dm_os_windows_info; 

Method 2 : Use xp_cmdshell - although this does mean enabling xp_cmdshell , which is in many organisations as security violation 

 

exec master..xp_cmdshell 'systeminfo'

 

Method 3: The @@version returns system and build information for the current SQL Server.

 

SELECT @@version

Method 4: xp_msver returns details about the actual build number of the server and information about the server environment.This can be very useful if you want to integrated as part of stored procedure, batch or other type of t-sql code. 

 

 xp_msver 

 

Sample output

1 ProductName NULL Microsoft SQL Server
2 ProductVersion 917504 14.0.3037.1
3 Language 1033 English (United States)
4 Platform NULL NT x64
5 Comments NULL SQL
6 CompanyName NULL Microsoft Corporation
7 FileDescription NULL SQL Server Windows NT - 64 Bit
8 FileVersion NULL 2017.0140.3037.01 ((SQLServer2017-CU10).180727-1609)
9 InternalName NULL SQLSERVR
10 LegalCopyright NULL Microsoft. All rights reserved.
11 LegalTrademarks NULL Microsoft SQL Server is a registered trademark of Microsoft Corporation.
12 OriginalFilename NULL SQLSERVR.EXE
13 PrivateBuild NULL NULL
14 SpecialBuild 199032833 NULL
15 WindowsVersion 199032833 6.3 (14393)
16 ProcessorCount 2 2
17 ProcessorActiveMask NULL 3
18 ProcessorType 8664 NULL
19 PhysicalMemory 5999 5999 (6290321408)
20 Product ID NULL NULL

 

Read More on other OS information methods

How to check Operating System type with Powershell (SQL Server ...


Author: Jack Vamvas (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Get Windows OS version using t-sql


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer