我如何知道机器上运行的是哪个版本的 SQL Server?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2070396/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I tell what edition of SQL Server runs on the machine?
提问by gyurisc
I am running SQL Server 2005 but I am unsure which edition this is. How can I decide what edition (Express, Standard, Enterprise etc) is running on the machine?
我正在运行 SQL Server 2005,但我不确定这是哪个版本。如何确定机器上运行的是哪个版本(Express、Standard、Enterprise 等)?
回答by Mehrdad Afshari
select @@version
Sample Output
Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64) Mar 29 2009 10:11:52 Copyright (c) 1988-2008 Microsoft Corporation Developer Edition (64-bit) on Windows NT 6.1 (Build 7600: )
样本输出
Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64) 2009 年 3 月 29 日 10:11:52 版权所有 (c) 1988-2008 Microsoft Corporation Developer Edition(64 位),Windows NT 6.1(内部版本 7600:)
If you just want to get the edition, you can use:
如果您只想获取版本,可以使用:
select serverproperty('Edition')
To use in an automated script, you can get the edition ID, which is an integer:
要在自动化脚本中使用,您可以获取版本 ID,它是一个整数:
select serverproperty('EditionID')
- -1253826760 = Desktop
- -1592396055 = Express
- -1534726760 = Standard
- 1333529388 = Workgroup
- 1804890536 = Enterprise
- -323382091 = Personal
- -2117995310 = Developer
- 610778273 = Enterprise Evaluation
- 1044790755 = Windows Embedded SQL
- 4161255391 = Express with Advanced Services
- -1253826760 = 桌面
- -1592396055 = 快递
- -1534726760 = 标准
- 1333529388 = 工作组
- 1804890536 = 企业
- -323382091 = 个人
- -2117995310 = 开发人员
- 610778273 = 企业评估
- 1044790755 = Windows 嵌入式 SQL
- 4161255391 = Express 高级服务
回答by marc_s
I use this query here to get all relevant info (relevant for me, at least :-)) from SQL Server:
我在此处使用此查询从 SQL Server 获取所有相关信息(与我相关,至少 :-)):
SELECT
SERVERPROPERTY('productversion') as 'Product Version',
SERVERPROPERTY('productlevel') as 'Product Level',
SERVERPROPERTY('edition') as 'Product Edition',
SERVERPROPERTY('buildclrversion') as 'CLR Version',
SERVERPROPERTY('collation') as 'Default Collation',
SERVERPROPERTY('instancename') as 'Instance',
SERVERPROPERTY('lcid') as 'LCID',
SERVERPROPERTY('servername') as 'Server Name'
That gives you an output something like this:
这会给你一个输出是这样的:
Product Version Product Level Product Edition CLR Version
10.0.2531.0 SP1 Developer Edition (64-bit) v2.0.50727
Default Collation Instance LCID Server Name
Latin1_General_CI_AS NULL 1033 *********
回答by Prashant Vadher
You can get just the edition name by using the following steps.
您可以使用以下步骤仅获取版本名称。
- Open "SQL Server Configuration Manager"
- From the List of SQL Server Services, Right Click on "SQL Server (Instance_name)" and Select Properties.
- Select "Advanced" Tab from the Properties window.
- Verify Edition Name from the "Stock Keeping Unit Name"
- Verify Edition Id from the "Stock Keeping Unit Id"
- Verify Service Pack from the "Service Pack Level"
- Verify Version from the "Version"
- 打开“SQL Server 配置管理器”
- 从 SQL Server 服务列表中,右键单击“SQL Server (Instance_name)”并选择属性。
- 从“属性”窗口中选择“高级”选项卡。
- 从“库存单位名称”验证版本名称
- 从“库存单位 ID”验证版本 ID
- 从“服务包级别”验证服务包
- 从“版本”验证版本
回答by AdaTheDev
You can get just the edition (plus under individual properties) using SERVERPROPERTY
您可以使用SERVERPROPERTY获得版本(加上单个属性)
e.g.
例如
SELECT SERVERPROPERTY('Edition')
Quote (for "Edition"):
报价(对于“版本”):
Installed product edition of the instance of SQL Server. Use the value of this property to determine the features and the limits, such as maximum number of CPUs, that are supported by the installed product.
Returns:
'Desktop Engine' (Not available for SQL Server 2005.)
'Developer Edition'
'Enterprise Edition'
'Enterprise Evaluation Edition'
'Personal Edition'(Not available for SQL Server 2005.)
'Standard Edition'
'Express Edition'
'Express Edition with Advanced Services'
'Workgroup Edition'
'Windows Embedded SQL'
Base data type: nvarchar(128)
已安装 SQL Server 实例的产品版本。使用此属性的值来确定已安装产品支持的功能和限制,例如最大 CPU 数。
返回:
“桌面引擎”(不适用于 SQL Server 2005。)
“开发版”
“企业版”
“企业评估版”
“个人版”(不适用于 SQL Server 2005。)
“标准版”
“速成版”
“ Express Edition with Advanced Services'
'Workgroup Edition'
'Windows Embedded SQL'
基本数据类型:nvarchar(128)
回答by Hossein Kohzadi
SELECT CASE WHEN SERVERPROPERTY('EditionID') = -1253826760 THEN 'Desktop'
WHEN SERVERPROPERTY('EditionID') = -1592396055 THEN 'Express'
WHEN SERVERPROPERTY('EditionID') = -1534726760 THEN 'Standard'
WHEN SERVERPROPERTY('EditionID') = 1333529388 THEN 'Workgroup'
WHEN SERVERPROPERTY('EditionID') = 1804890536 THEN 'Enterprise'
WHEN SERVERPROPERTY('EditionID') = -323382091 THEN 'Personal'
WHEN SERVERPROPERTY('EditionID') = -2117995310 THEN 'Developer'
WHEN SERVERPROPERTY('EditionID') = 610778273 THEN 'Windows Embedded SQL'
WHEN SERVERPROPERTY('EditionID') = 4161255391 THEN 'Express with Advanced Services'
END AS 'Edition';