sql server键查找_如何查找SQL Server版本

本文详述如何通过多种方式查询SQL Server版本信息,包括使用SSMS、查询语句及检查错误日志,帮助数据库管理员识别SQL Server的具体版本、Service Pack和累积更新等详细细节。

sql server键查找

In this article, we will explore how to find the SQL Server version details with various methods.

在本文中,我们将探索如何使用各种方法查找SQL Server版本详细信息。

介绍 (Introduction)

One of the important responsibilities of a database administrator is to keep the SQL Server installation up-to-date. The installation list for the update process can be created from the following items:

数据库管理员的重要职责之一是使SQL Server安装保持最新。 可以从以下各项创建更新过程的安装列表:

  • Service packs

    服务包
  • Cumulative updates

    累积更新
  • General Distribution Releases (GDR)

    一般发行版本(GDR)
  • Version upgrades

    版本升级

On the other hand, the SQL Server edition upgrade might be taken to the agenda by the database administrators to obtain new features. Such as, for some cases, we might be faced an issue that needs to determine the service pack level of the SQL Server. For this reason, the database administrator may always need to know the version and edition details of the SQL Server with whole details or at least know how to obtain it. Now, we will go through different methods on how to find version details of the SQL Server.

另一方面,数据库管理员可能会将SQL Server版本升级列入议程以获取新功能。 例如,在某些情况下,我们可能会遇到需要确定SQL Server Service Pack级别的问题。 因此,数据库管理员可能总是需要了解SQL Server的版本和版本详细信息以及完整的详细信息,或者至少知道如何获取它。 现在,我们将通过不同的方法来查找SQL Server的版本详细信息。

使用SSMS查找SQL Server版本 (Finding the SQL Server version with SSMS)

SQL Server Management Studio (SSMS) is a very helpful and handy tool in order to manage the SQL Server installations. Also, when we connect to any instance of the SQL Server with the help of SSMS, we can see that the product version is shown in the Object Explorer tab between two parentheses. This set of numbers defines the product version of the SQL Server. Now, we will learn how to convert the version details from this meaningless set of numbers:

为了管理SQL Server安装,SQL Server Management Studio(SSMS)是非常有用且方便的工具。 另外,当我们借助SSMS连接到SQL Server的任何实例时,我们可以看到产品版本显示在两个括号之间的“对象资源管理器”选项卡中。 这组数字定义了SQL Server的产品版本。 现在,我们将学习如何从这组毫无意义的数字中转换版本详细信息:

To find SQL Server version

In the above screenshot, the product version is specified as 15.0.1400.75 but this set of numbers is not much meaningful and therefore we should convert it to more meaningful and useful information. The first two-digits (15) define the numeric definition of the SQL Server product name. The following table shows SQL Server versions against the product name so that we can find out the product name rather quickly:

在上面的屏幕截图中,产品版本指定为15.0.1400.75,但是这组数字没有太大意义,因此我们应该将其转换为更有意义和有用的信息。 前两位(15)定义SQL Server产品名称的数字定义。 下表根据产品名称显示了SQL Server版本,以便我们可以快速找到产品名称:

SQL Server Product Version

SQL Server Product Name

15.0.xxxx.xx

SQL Server 2019

14.0.xxxx.xx

SQL Server 2017

13.0.xxxx.xx

SQL Server 2016

12.0.xxxx.xx

SQL Server 2014

11.0.xxxx.xx

SQL Server 2012

10.5.xxxx.xx

SQL Server 2008 R2

10.0.xxxx.xx

SQL Server 2008

9.0.xxxx.xx

SQL Server 2005

8.0.xxxx.xx

SQL Server 2000

SQL Server产品版本

SQL Server产品名称

15.0.xxxx.xx

SQL Server 2019

14.0.xxxx.xx

SQL Server 2017

13.0.xxxx.xx

SQL Server 2016

12.0.xxxx.xx

SQL Server 2014

11.0.xxxx.xx

SQL Server 2012

10.5.xxxx.xx

SQL Server 2008 R2

10.0.xxxx.xx

SQL Server 2008

9.0.xxxx.xx

SQL Server 2005

8.0.xxxx.xx

SQL Server 2000

However, we achieved the product name only with the help of the first two-digits but we need more details about the SQL Server instance. The remaining numbers (1400.75) provide assistance to uncover service pack level and cumulative update level details. In order to find out these details, we can look at the BuildNumbers website so that we can easily figure out all the detailed information about the SQL Server instance:

但是,我们仅在前两位数字的帮助下获得了产品名称,但是我们需要有关SQL Server实例的更多详细信息。 剩余的数字(1400.75)将帮助您发现Service Pack级别和累积更新级别详细信息。 为了找出这些详细信息,我们可以查看BuildNumbers网站,以便我们可以轻松找出有关SQL Server实例的所有详细信息:

SQL Server version number details.

For our example, the version number is 15.0.1400.75 and it comes up to SQL Server 2019 CTP 2.4. (Community Technology Preview 2.4) which was released on March 26, 2019, as shown in the table. At the same time, this table helps us to discover the latest version of the SQL Servers.

对于我们的示例,版本号是15.0.1400.75,它取决于SQL Server 2019 CTP 2.4。 如表所示,于2019年3月26日发布了(Community Technology Preview 2.4)。 同时,此表可帮助我们发现SQL Server的最新版本。

使用查询查找SQL Server版本 (Finding the SQL Server version with query)

We can use the @@VERSION function to find out all version details of the SQL Server instance. The @@VERSION function returns a one-line string output and this output also provides all the necessary information about the SQL Server.

我们可以使用@@ VERSION函数来查找SQL Server实例的所有版本详细信息。 的 @@版 函数返回单行字符串输出,该输出还提供有关SQL Server的所有必要信息。

The output of this function will be involved in the following information:

此功能的输出将包含在以下信息中:

  • SQL Server Version

    SQL Server版本
  • Processor Architecture

    处理器架构
  • SQL Server Build Date

    SQL Server生成日期
  • Copyright Statement

    版权声明
  • SQL Server Edition

    SQL Server版
  • Operating System Version

    作业系统版本

Now, we will run the following query and get the details of the SQL Server:

现在,我们将运行以下查询并获取SQL Server的详细信息:

SELECT @@VERSION AS 'SQL Server Version Details'

@@VERSION function output and SQL Server version details

“Microsoft SQL Server 2019 (CTP2.4) – 15.0.1400.75 (X64) Mar 16 2019 11:53:26 Copyright (C) 2019 Microsoft Corporation Enterprise Evaluation Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 17763: )”

“ Microsoft SQL Server 2019(CTP2.4)– 15.0.1400.75(X64)2019年3月16日11:53:26版权所有(C)2019 Windows 10 Pro 10.0 <X64>上的Microsoft Corporation企业评估版(64位) 17763 :)”

As we can see, the output of the @@VERSION function returns sufficiently information about SQL Server. We will convert this information into a more meaningful form with the help of the following table:

如我们所见,@@ VERSION函数的输出返回有关SQL Server的足够信息。 我们将借助下表将这些信息转换为更有意义的形式:

SQL Server version

Microsoft SQL Server 2019 (CTP2.4)-15.0.1400.75

Processor architecture

X64

SQL Server build date

Mar 16 2019 11:53:26

Copyright statement

Copyright (C) 2019 Microsoft Corporation

SQL Server edition

Enterprise Evaluation Edition (64-bit)

Operating system version

Windows 10 Pro 10.0 <X64> (Build 17763: )

SQL Server版本

Microsoft SQL Server 2019(CTP2.4)-15.0.1400.75

处理器架构

X64

SQL Server生成日期

三月16 2019 11:53:26

版权声明

版权所有(C)2019 Microsoft Corporation

SQL Server版本

企业评估版(64位)

作业系统版本

Windows 10 Pro 10.0 <X64>(内部版本17763:)

在SQL Server错误日志中查找SQL Server版本 (Finding the SQL Server version in the SQL Server error logs)

SQL Server error log file records user-defined events and specific system events so that we can use it to troubleshoot SQL Server issues. Other than this, the SQL Server error log file helps us to determine the version details of the SQL Server. In the first few lines of the error log file, it contains detailed information about the version information about the SQL Server. By default, the error log is placed under “Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\LOG\”. The other option which helps us to determine the error log file location is the SERVERPROPERTY function. The following query returns the location of the error log file:

SQL Server错误日志文件记录了用户定义的事件和特定的系统事件,以便我们可以使用它来解决SQL Server问题。 除此之外,SQL Server错误日志文件还可以帮助我们确定SQL Server的版本详细信息。 在错误日志文件的前几行中,它包含有关SQL Server版本信息的详细信息。 默认情况下,错误日志位于“ Program Files \ Microsoft SQL Server \ MSSQL.n \ MSSQL \ LOG \”下。 帮助我们确定错误日志文件位置的另一个选项是SERVERPROPERTY函数。 以下查询返回错误日志文件的位置:

SELECT SERVERPROPERTY('ErrorLogFileName') AS 'Error log file location'

SQL Server errorlog file path

Now, we will open the error log file in the specified location:

现在,我们将在指定位置打开错误日志文件:

Find SQL Server version with help of the errorlog file

The entry of the error log file provides all details about the SQL Server build. The other method to read the error log is sp_readerrorlog procedure and the first line of the resultset indicates the SQL Server instance details:

错误日志文件的条目提供了有关SQL Server构建的所有详细信息。 读取错误日志的另一种方法是sp_readerrorlog过程,结果集的第一行指示SQL Server实例详细信息:

sp_readerrorlog procedure resultset

结论 (Conclusion)

In this article, we mentioned how to find out the SQL Server version with the different methods and also learned how to convert it to more meaningful information. After reading this article, you should be able to distinguish which SQL Server product version number corresponds exactly to which specific definition and other detailed information.

在本文中,我们提到了如何使用不同的方法找出SQL Server版本,并且还学习了如何将其转换为更有意义的信息。 阅读本文之后,您应该能够分辨出哪个SQL Server产品版本号与哪个特定定义以及其他详细信息完全对应。

翻译自: https://www.sqlshack.com/how-to-find-sql-server-version/

sql server键查找

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值