我想知道运行SQL Server的版本。你能帮忙吗?
答案 0 :(得分:4)
连接到SQL Server实例,然后运行以下查询:
Select @@version
此查询的输出示例如下:
Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64) Mar 29 2009
10:11:52 Copyright (c) 1988-2008 Microsoft Corporation Express
Edition (64-bit) on Windows NT 6.1 <X64> (Build 7600: )
答案 1 :(得分:3)
有关版本信息和其他属性的完整列表,请尝试xp_msver
例如:
EXEC master..xp_msver
提供表格的输出:
1 ProductName NULL Microsoft SQL Server
2 ProductVersion 589824 9.00.4053.00
3 Language 1033 English (United States)
4 Platform NULL NT AMD64
5 Comments NULL NT AMD64
6 CompanyName NULL Microsoft Corporation
7 FileDescription NULL SQL Server Windows NT - 64 Bit
8 FileVersion NULL 2005.090.4053.00
9 InternalName NULL SQLSERVR
10 LegalCopyright NULL © Microsoft Corp. All rights reserved.
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 265617408 NULL
15 WindowsVersion 248381957 5.2 (3790)
16 ProcessorCount 8 8
17 ProcessorActiveMask 8 ff
18 ProcessorType 8664 NULL
19 PhysicalMemory 32768 32768 (34359439360)
20 Product ID NULL NULL
有关于检索SQL Server version information的完整知识库文章 - 除了使用@@Version
的其他答案外,您还可以使用:
SELECT SERVERPROPERTY('productversion'),
SERVERPROPERTY ('productlevel'),
SERVERPROPERTY ('edition')
有时首选SERVERPROPERTY的原因是@@ Version在旧版本中返回OS Service Pack
级别,而不是 SQL Server Service Pack
级别 - 请参阅http://beyondrelational.com/modules/2/blogs/69/posts/18272/sql-server-version-showing-incorrect-service-pack-information.aspx和{例如{3}}。
答案 2 :(得分:0)
您可以为任何版本的SQL Server https://i.stack.imgur.com/dZcbb.png编写以下查询 https://i.stack.imgur.com/A0Kqa.png
SELECT
create_date AS 'SQL Server Installation Date',
DATEADD(DD, 180, create_date) AS 'SQL Server Expiration Date',
SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('ProductLevel') AS ProductLevel,
SERVERPROPERTY('Edition') AS Edition
FROM sys.server_principals
WHERE name = 'NT AUTHORITY\SYSTEM'
答案 3 :(得分:-1)
在SSMS查询中运行此代码,您将获得SQL Server的版本
SELECT @@Version