xp_msver

Transact-SQL Reference

Transact-SQL Reference

xp_msver

Returns and allows to be queried Microsoft® SQL Server™ version information. In addition to version information regarding the actual build number of the server, various environment information is also returned. This information can be used within Transact-SQL statements, batches, stored procedures, and so on, to enhance logic for platform-independent code.

Syntax

xp_msver [optname]

Arguments

optname

Is the name of an option, and can be one of the following.

Option/Column name Description
ProductName Product name; for example, Microsoft SQL Server.
ProductVersion Product version; for example, 7.00.419 where 7.00 is the version and 419 is the Microsoft internal build number.
Language The language version of SQL Server.
Platform Operating-system name, manufacturer name, and chip family name for the computer running SQL Server. For example, NT INTEL X86 indicates Microsoft Windows NT® as the operating system, Intel as the chip manufacturer, and a 486 or higher processor.
Comments Miscellaneous information about SQL Server.
CompanyName Company name that produces SQL Server; for example, Microsoft Corporation.
FileDescription The operating system.
FileVersion Version of the SQL Server executable. For example, 1998.02.01 indicates a file version of February 1, 1998, on the Sqlservr.exe file.
InternalName Microsoft internal name for SQL Server; for example, SQLSERVR.
LegalCopyright Legal copyright information required for SQL Server; for example, Copyright© Microsoft Corp. 1998.
LegalTrademarks Legal trademark information required for SQL Server. For example, Microsoft® is a registered trademark of Microsoft Corporation.
OriginalFilename File name executed at SQL Server startup; for example, Sqlservr.exe.
PrivateBuild Reserved.
SpecialBuild Reserved.
WindowsVersion Microsoft Windows version installed on the computer running SQL Server. For example, 4.0 indicates version 4.0 of Microsoft Windows NT, and 1381 indicates the internal build number.
ProcessorCount The number of processors in the computer running SQL Server.
ProcessorActiveMask Indicates what processors installed in the computer running SQL Server are activated and usable by Microsoft Windows NT.
ProcessorType Processor type. Similar to Platform.
PhysicalMemory Amount in megabytes (MB) of RAM installed on the computer running SQL Server. For example, 32 indicates 32 MB of RAM.
Product ID Product ID (PID) number, which is specified during installation. This number is located on a sticker on the original SQL Server compact disc case.
Return Code Values

0 (success) or 1 (failure)

Result Sets

xp_msver, without any parameters, returns this four-column result set (values may vary):

Index  Name                     Internal_Value Character_Value                                                                                                                                                                                                       
------ ------------------------ -------------- ---------------- 
1      ProductName              NULL           Microsoft SQL 
                                   Server
2      ProductVersion           458752         7.00.498
3      Language                 1033           English (United 
                                   States)
4      Platform                 NULL           NT INTEL X86
5      Comments                 NULL           NT INTEL X86
6      CompanyName              NULL           Microsoft 
                                   Corporation
7      FileDescription          NULL           SQL Server 
                                   Windows NT
8      FileVersion              NULL           1998.05.25
9      InternalName             NULL           SQLSERVR
10     LegalCopyright           NULL           Copyright © 
                                   Microsoft Corp. 1998
11     LegalTrademarks          NULL           Microsoft® is a 
                                   registered trademark of                                       Microsoft Corporation.                                       Windows(TM) is a                                             trademark of Microsoft                                       Corporation
12     OriginalFilename         NULL           SQLSERVR.EXE
13     PrivateBuild             NULL           NULL
14     SpecialBuild             262242         NULL
15     WindowsVersion           90505220       4.0 (1381)
16     ProcessorCount           1              1
17     ProcessorActiveMask      1              00000001
18     ProcessorType            586            PROCESSOR_INTEL_PENTIUM
19     PhysicalMemory           63             63 (66510848)
20     Product ID               NULL           NULL

(20 row(s) affected)

xp_msver, for any option, returns the four-column headings with values for that option. For example, this result set is returned when xp_msver is executed with the FileDescription option.

xp_msver FileDescription

Index  Name                      Internal_Value Character_Value                                                                                                                                                                                                       
------ ------------------------- -------------- ------------------------
7      FileDescription           NULL           SQL Server Windows NT

(1 row(s) affected)
Permissions

Execute permissions default to the public role.

See Also

System Functions

System Stored Procedures (General Extended Procedures)

@@VERSION