aoaomssql-sqlserver-mssql
🌸 SQL Server官方手册
https://learn.microsoft.com/zh-cn/sql/sql-server/?view=sql-server-ver16
🥀SQL Server 下载
https://sqlserverbuilds.blogspot.com/
🌹 补丁下载
大补丁下载 SQL Server的最新更新和版本历史记录
https://learn.microsoft.com/zh-cn/troubleshoot/sql/releases/download-and-install-latest-updates
小补丁下载
https://www.catalog.update.microsoft.com/home.aspx
SSMS下载
查看SQL 版本
https://sqlserverbuilds.blogspot.com/2019/01/how-do-i-find-sql-server-version.html
GUI tools 图形化工具
Method 1: Using SQL Server Management Studio
方法 1:使用 SQL Server Management Studio
The SQL Server Management Studio (SSMS) is the integrated environment for managing your SQL Server infrastructure. Management Studio is now a completely standalone product, not tied to any specific version or edition of SQL Server, and no longer requires licensing of any kind.
SQL Server Management Studio (SSMS) 是用于管理 SQL Server 基础结构的集成环境。 Management Studio 现在是一个完全独立的产品,不依赖于任何特定版本的 SQL Server,也不再需要任何类型的许可。
Option A: Object Explorer: 选项 A:对象资源管理器:
Connect to the server by using Object Explorer in SQL Server Management Studio. When Object Explorer is connected, it shows version information in parentheses.
使用 SQL Server Management Studio 中的对象资源管理器连接到服务器。连接对象资源管理器时,它会在括号中显示版本信息。
Option B: Server Properties dialog:
选项 B:服务器属性对话框:
Option C: Execute SQL statement: 选项C:执行SQL语句:
Method 2: Windows Explorer – file properties
方法 2:Windows 资源管理器 – 文件属性
Example: 例子:
Path: C:\Program Files\Microsoft SQL Server\MSSQL14.SQL2017\MSSQL\Binn
File: sqlservr.exe
Method 3: Windows Registry editor
方法 3:Windows 注册表编辑器
Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL{MajorVersion}.{InstanceName}\Setup
Value: PatchLevel
Example: 例子:
SQL Server 2017 (→ major version "14"), instance name "SQL2017"
SQL Server 2017(→ 主要版本“14”),实例名称“SQL2017”
Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL14.SQL2017\Setup
Method 4: SQL Server ERRORLOG file
方法 4:SQL Server ERRORLOG 文件
Path: C:\Program Files\Microsoft SQL Server\MSSQL{MajorVersion}.{InstanceName}\MSSQL\Log
File: ERRORLOG (without extension)
Example: 例子:
SQL Server 2017 (→ major version "14"), instance name "SQL2017"
SQL Server 2017(→ 主要版本“14”),实例名称“SQL2017”
Path: C:\Program Files\Microsoft SQL Server\MSSQL14.SQL2017\MSSQL\Log
From command line 从命令行
Possible SQL statements: 可能的 SQL 语句:
SELECT @@VERSION;
Typical results: 典型结果:
Microsoft SQL Server 2017 (RTM-CU13-OD) (KB4483666) - 14.0.3049.1 (X64)
Dec 15 2018 11:16:42
Copyright (C) 2017 Microsoft Corporation
Developer Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 17763: )
(1 row affected)
Microsoft SQL Server 2019 (RTM-GDR) (KB4517790) - 15.0.2070.41 (X64)
Oct 28 2019 19:56:59
Copyright (C) 2019 Microsoft Corporation
Developer Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 17763: )
(1 row affected)
-or-
SELECT SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('ProductLevel') AS ProductLevel,
SERVERPROPERTY('Edition') AS Edition,
SERVERPROPERTY('ProductUpdateLevel') AS ProductUpdateLevel,
SERVERPROPERTY('ProductUpdateReference') AS ProductUpdateReference;
Typical result: 典型结果:
ProductVersion ProductLevel Edition ProductUpdateLevel ProductUpdateReference
----------------------------------------------------------------------------------------------------
14.0.3049.1 RTM Developer Edition (64-bit) CU13 KB4483666
(1 row affected)
-or-
EXEC sys.xp_msver;
Typical result: 典型结果:
Index Name Internal_Value Character_Value
------ -------------------- -------------- ------------------------------------------------------------------------
1 ProductName NULL Microsoft SQL Server
2 ProductVersion 917504 14.0.3049.1
3 Language 1029 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.3049.01 ((SQLServer2017-CU13-OD).181215-1843)
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 199819265 NULL
15 WindowsVersion 199819265 6.3 (17763)
16 ProcessorCount 4 4
17 ProcessorActiveMask NULL f
18 ProcessorType 8664 NULL
19 PhysicalMemory 3978 3978 (4171210752)
20 Product ID NULL NULL
(20 rows affected)
You can also use specific option:
您还可以使用特定选项:
EXEC sys.xp_msver 'ProductVersion';
Typical result: 典型结果:
Index Name Internal_Value Character_Value
------ -------------------- -------------- ---------------
2 ProductVersion 917504 14.0.3049.1
(1 row affected)
Method 5: SQLCMD Utility
方法 5: SQLCMD 实用程序
SQLCMD is a part of the SQL Server Client Tools.
SQLCMD 是 SQL Server 客户端工具的一部分。
Example: 例子:
sqlcmd.exe -S ServerName\InstanceName -E -Q "SELECT @@VERSION"
Method 6: OSQL Utility
方法 6: OSQL 实用程序
OSQL is a part of the SQL Server Client Tools (obsolete but still functional).
OSQL 是 SQL Server 客户端工具的一部分(已过时但仍然有效)。
Example: 例子:
osql.exe -S ServerName\InstanceName -E -Q "SELECT @@VERSION"
Method 7: Windows PowerShell 方法 7:Windows PowerShell
Example: 例子:
# The SQLPS module must be installed
Import-Module SQLPS
Invoke-SqlCmd -ServerInstance ".\SQL2017" -Query "SELECT @@VERSION"
Command line examples 命令行示例
Example 1: A batch that creates a CSV file with versions from multiple SQL Servers
示例 1:使用来自多个 SQL Server 的版本创建 CSV 文件的批处理
Windows batch SqlServerVersionsToCsv.cmd:
echo SQLServer,Version > SQLServerVersions.csv
set query="SET NOCOUNT ON; SELECT CONCAT(CAST(SERVERPROPERTY('ServerName') AS VARCHAR(30)), ',', CAST(SERVERPROPERTY('ProductVersion') AS VARCHAR(30)));"
sqlcmd.exe -S Server1\Instance1 -E -h-1 -W -Q %query% >> SQLServerVersions.csv
sqlcmd.exe -S Server1\Instance2 -E -h-1 -W -Q %query% >> SQLServerVersions.csv
sqlcmd.exe -S Server2\Instance1 -E -h-1 -W -Q %query% >> SQLServerVersions.csv
.
.
etc.
You need to replace the ServerX\InstanceY with your SQL Server names, e.g. (local)\SQL2017, (local)\SQL2016.
您需要将 ServerX\InstanceY 替换为您的 SQL Server 名称,例如 (local)\SQL2017 , (local)\SQL2016 。
Typical result – content of the file SQLServerVersions.csv:
典型结果——文件 SQLServerVersions.csv 的内容:
SQLServer,Version
SERVER1\SQL2017,14.0.3049.1
SERVER1\SQL2016,13.0.5239.0
SERVER2\SQL2014,12.0.6205.1
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 xieaoao@qq.com QQ:1296454177