SQL Server/T-SQL Tutorial/System Settings/xp msver
EXEC master..xp_msver
2> EXEC master..xp_msver
3> GO
Index Name Internal_Value Character_Value
------ -------------------------------- -------------- ------------------------------------------------------------------------------------------------------------------------
1 ProductName NULL Microsoft SQL Server
2 ProductVersion 589824 9.00.1399.06
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 2005.090.1399.00
9 InternalName NULL SQLSERVR
10 LegalCopyright NULL c Microsoft Corp. All rights reserved.
11 LegalTrademarks NULL Microsoftr 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 91684864 NULL
15 WindowsVersion 170393861 5.1 (2600)
16 ProcessorCount 1 1
17 ProcessorActiveMask 1 00000001
18 ProcessorType 586 PROCESSOR_INTEL_PENTIUM
19 PhysicalMemory 1023 1023 (1073201152)
20 Product ID NULL NULL
(20 rows affected)
xp_msver function
4> CREATE TABLE #VersionTable(
5> [Index] int PRIMARY KEY,
6> Name varchar(30),
7> Internal_Value int,
8> Character_Value varchar(250)
9> )
10> GO
1>
2> INSERT INTO #VersionTable
3> EXEC master..xp_msver
4>
5> DECLARE @Version int
6>
7> SELECT @Version = (SELECT Internal_Value
8> FROM #VersionTable
9> WHERE Name = "ProductVersion")
10> IF (@Version) >= 524288
11> PRINT "Running SS2K Beta 2 or Later"
12> ELSE
13> IF @Version >= 458752
14> PRINT "Running 7.0 RTM or Later"
15> ELSE
16> PRINT "Running Pre 7.0 RTM Version"
17> GO
(20 rows affected)
(20 rows affected)
Running SS2K Beta 2 or Later
1> DROP TABLE #VersionTable
2> GO