SERVERPROPERTY (Transact-SQL)SERVERPROPERTY (Transact-SQL)

適用於: 是SQL Server 是Azure SQL Database 是Azure SQL 資料倉儲 是平行處理資料倉儲 APPLIES TO: yesSQL Server yesAzure SQL Database yesAzure SQL Data Warehouse yesParallel Data Warehouse

傳回有關伺服器執行個體的屬性資訊。Returns property information about the server instance.

主題連結圖示 Transact-SQL 語法慣例Topic link icon Transact-SQL Syntax Conventions

語法Syntax

SERVERPROPERTY ( 'propertyname' )  

引數Arguments

propertynamepropertyname
這是包含要傳回伺服器之屬性資訊的運算式。Is an expression that contains the property information to be returned for the server. propertyname 可以是下列值之一。propertyname can be one of the following values.

屬性Property 傳回的值Values returned
BuildClrVersionBuildClrVersion 建立 SQL ServerSQL Server 執行個體時所用的 MicrosoftMicrosoft.NET Framework.NET Framework 通用語言執行平台 (CLR) 版本。Version of the MicrosoftMicrosoft.NET Framework.NET Framework common language runtime (CLR) that was used while building the instance of SQL ServerSQL Server.

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
定序Collation 伺服器預設定序的名稱。Name of the default collation for the server.

NULL = 輸入無效,或發生錯誤。NULL = Input is not valid, or an error.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
CollationIDCollationID SQL ServerSQL Server 定序的識別碼。ID of the SQL ServerSQL Server collation.

基底資料類型:intBase data type: int
ComparisonStyleComparisonStyle Windows 的定序比較樣式。Windows comparison style of the collation.

基底資料類型:intBase data type: int
ComputerNamePhysicalNetBIOSComputerNamePhysicalNetBIOS SQL ServerSQL Server 執行個體目前執行所在之本機電腦的 NetBIOS 名稱。NetBIOS name of the local computer on which the instance of SQL ServerSQL Server is currently running.

如果是容錯移轉叢集中的 SQL ServerSQL Server 叢集執行個體,當 SQL ServerSQL Server 執行個體容錯移轉到容錯移轉叢集中的其他節點時,這個值會跟著改變。For a clustered instance of SQL ServerSQL Server on a failover cluster, this value changes as the instance of SQL ServerSQL Server fails over to other nodes in the failover cluster.

SQL ServerSQL Server 的獨立執行個體中,這個值會維持不變,且會傳回與 MachineName 屬性相同的值。On a stand-alone instance of SQL ServerSQL Server, this value remains constant and returns the same value as the MachineName property.

注意: 如果 SQL ServerSQL Server 執行個體在容錯移轉叢集中,且您想要取得容錯移轉叢集執行個體的名稱,請使用 MachineName 屬性。Note: If the instance of SQL ServerSQL Server is in a failover cluster and you want to obtain the name of the failover clustered instance, use the MachineName property.

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
版本Edition 已安裝的 SQL ServerSQL Server 執行個體產品版本。Installed product edition of the instance of SQL ServerSQL Server. 使用這個屬性值決定功能和限制,例如根據 SQL Server 版本計算容量限制Use the value of this property to determine the features and the limits, such as Compute Capacity Limits by Edition of SQL Server. 64 位元版的 Database EngineDatabase Engine 會將 (64 位元) 附加至版本中。64-bit versions of the Database EngineDatabase Engine append (64-bit) to the version.

傳回:Returns:

'Enterprise Edition''Enterprise Edition'

「Enterprise 版:核心授權」'Enterprise Edition: Core-based Licensing'

'Enterprise Evaluation Edition''Enterprise Evaluation Edition'

'Business Intelligence Edition''Business Intelligence Edition'

'Developer Edition''Developer Edition'

'Express Edition''Express Edition'

'Express Edition with Advanced Services''Express Edition with Advanced Services'

'Standard Edition''Standard Edition'

'Web Edition''Web Edition'

'SQL Azure' 表示 SQL DatabaseSQL DatabaseSQL 資料倉儲SQL Data Warehouse'SQL Azure' indicates SQL DatabaseSQL Database or SQL 資料倉儲SQL Data Warehouse

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
EditionIDEditionID EditionID 表示安裝的 SQL ServerSQL Server 執行個體產品版本。EditionID represents the installed product edition of the instance of SQL ServerSQL Server. 使用這個屬性值決定功能和限制,例如根據 SQL Server 版本計算容量限制Use the value of this property to determine features and limits, such as Compute Capacity Limits by Edition of SQL Server.

1804890536 = Enterprise1804890536 = Enterprise

1872460670 = Enterprise Edition:核心授權1872460670 = Enterprise Edition: Core-based Licensing

610778273= Enterprise Evaluation610778273= Enterprise Evaluation

284895786 = Business Intelligence284895786 = Business Intelligence

-2117995310 = Developer-2117995310 = Developer

-1592396055 = Express-1592396055 = Express

-133711905 = Express with Advanced Services-133711905= Express with Advanced Services

-1534726760 = Standard-1534726760 = Standard

1293598313 = Web1293598313 = Web

1674378470 = SQL 資料庫或 SQL 資料倉儲1674378470 = SQL Database or SQL Data Warehouse

基底資料型別:bigintBase data type: bigint
EngineEditionEngineEdition 安裝在伺服器上之 Database EngineDatabase Engine 執行個體的 SQL ServerSQL Server 版本。Database EngineDatabase Engine edition of the instance of SQL ServerSQL Server installed on the server.

1 = Personal 或 Desktop Engine (不適用於 SQL Server 2005 (9.x)SQL Server 2005 (9.x) 和更新版本中)。1 = Personal or Desktop Engine (Not available in SQL Server 2005 (9.x)SQL Server 2005 (9.x) and later versions.)

2 = Standard (Standard、Web 和 Business Intelligence 都會傳回這個值)。2 = Standard (This is returned for Standard, Web, and Business Intelligence.)

3 = Enterprise (Enterprise、Developer 和兩種 Enterprise 版本都會傳回這個項目)。3 = Enterprise (This is returned for Evaluation, Developer, and both Enterprise editions.)

4 = Express (Express、Express with Tools 和 Express with Advanced Services 都會傳回這個值)4 = Express (This is returned for Express, Express with Tools and Express with Advanced Services)

5 = SQL DatabaseSQL Database5 = SQL DatabaseSQL Database

6 - SQL 資料倉儲SQL Data Warehouse6 - SQL 資料倉儲SQL Data Warehouse

8 = 受控執行個體8 = managed instance

基底資料類型:intBase data type: int
HadrManagerStatusHadrManagerStatus 適用於SQL Server 2012 (11.x)SQL Server 2012 (11.x)SQL Server 2017SQL Server 2017Applies to: SQL Server 2012 (11.x)SQL Server 2012 (11.x) through SQL Server 2017SQL Server 2017.

指出 AlwaysOn 可用性群組Always On availability groups 管理員是否已經啟動。Indicates whether the AlwaysOn 可用性群組Always On availability groups manager has started.

0 = 未啟動,暫止通訊。0 = Not started, pending communication.

1 = 已啟動且在執行中。1 = Started and running.

2 = 未啟動且失敗。2 = Not started and failed.

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.
InstanceDefaultDataPathInstanceDefaultDataPath 適用對象SQL Server 2012 (11.x)SQL Server 2012 (11.x) 至目前版本 (從 2015 晚期開始的更新)。Applies to: SQL Server 2012 (11.x)SQL Server 2012 (11.x) through current version in updates beginning in late 2015.

執行個體資料檔案的預設路徑名稱。Name of the default path to the instance data files.
InstanceDefaultLogPathInstanceDefaultLogPath 適用對象SQL Server 2012 (11.x)SQL Server 2012 (11.x) 至目前版本 (從 2015 晚期開始的更新)。Applies to: SQL Server 2012 (11.x)SQL Server 2012 (11.x) through current version in updates beginning in late 2015.

執行個體記錄檔的預設路徑名稱。Name of the default path to the instance log files.
InstanceNameInstanceName 使用者所連接之執行個體的名稱。Name of the instance to which the user is connected.

如果執行個體名稱是預設執行個體、輸入無效,或發生錯誤,便傳回 NULL。Returns NULL if the instance name is the default instance, if the input is not valid, or error.

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
IsAdvancedAnalyticsInstalledIsAdvancedAnalyticsInstalled 若在設定時已安裝 [進階分析] 功能,則會傳回 1;否則會傳回 0。Returns 1 if the Advanced Analytics feature was installed during setup; 0 if Advanced Analytics was not installed.
IsClusteredIsClustered 伺服器執行個體設定在容錯移轉叢集中。Server instance is configured in a failover cluster.

1 = 叢集。1 = Clustered.

0 = 非叢集。0 = Not Clustered.

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.

基底資料類型:intBase data type: int
IsFullTextInstalledIsFullTextInstalled 全文檢索和語意索引元件安裝在目前的 SQL ServerSQL Server 執行個體上。The full-text and semantic indexing components are installed on the current instance of SQL ServerSQL Server.

1 = 已安裝全文檢索和語意索引元件。1 = Full-text and semantic indexing components are installed.

0 = 未安裝全文檢索和語意索引元件。0 = Full-text and semantic indexing components are not installed.

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.

基底資料類型:intBase data type: int
IsHadrEnabledIsHadrEnabled 適用於SQL Server 2012 (11.x)SQL Server 2012 (11.x)SQL Server 2017SQL Server 2017Applies to: SQL Server 2012 (11.x)SQL Server 2012 (11.x) through SQL Server 2017SQL Server 2017.

在這個伺服器執行個體上已啟用 AlwaysOn 可用性群組Always On availability groupsAlwaysOn 可用性群組Always On availability groups is enabled on this server instance.

0 = AlwaysOn 可用性群組Always On availability groups 功能已停用。0 = The AlwaysOn 可用性群組Always On availability groups feature is disabled.

1 = AlwaysOn 可用性群組Always On availability groups 功能已啟用。1 = The AlwaysOn 可用性群組Always On availability groups feature is enabled.

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.

基底資料類型:intBase data type: int

若要在 SQL ServerSQL Server 的執行個體上建立及執行可用性複本,必須在此伺服器執行個體上啟用 AlwaysOn 可用性群組Always On availability groupsFor availability replicas to be created and run on an instance of SQL ServerSQL Server, AlwaysOn 可用性群組Always On availability groups must be enabled on the server instance. 如需詳細資訊,請參閱啟用和停用 AlwaysOn 可用性群組 (SQL Server)For more information, see Enable and Disable AlwaysOn Availability Groups (SQL Server).

注意: IsHadrEnabled 屬性只與 AlwaysOn 可用性群組Always On availability groups 相關。Note: The IsHadrEnabled property pertains only to AlwaysOn 可用性群組Always On availability groups. 此伺服器屬性不影響其他高可用性或災害復原功能,例如資料庫鏡像或記錄傳送。Other high availability or disaster recovery features, such as database mirroring or log shipping, are unaffected by this server property.
IsIntegratedSecurityOnlyIsIntegratedSecurityOnly 伺服器處於整合式安全性模式。Server is in integrated security mode.

1 = 整合式安全性 (Windows 驗證)1 = Integrated security (Windows Authentication)

0 = 非整合式安全性。0 = Not integrated security. (Windows 驗證及 SQL ServerSQL Server 驗證)。(Both Windows Authentication and SQL ServerSQL Server Authentication.)

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.

基底資料類型:intBase data type: int
IsLocalDBIsLocalDB 適用於SQL Server 2012 (11.x)SQL Server 2012 (11.x)SQL Server 2017SQL Server 2017Applies to: SQL Server 2012 (11.x)SQL Server 2012 (11.x) through SQL Server 2017SQL Server 2017.

伺服器是 SQL Server ExpressSQL Server Express LocalDB 的執行個體。Server is an instance of SQL Server ExpressSQL Server Express LocalDB.

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.
IsPolyBaseInstalledIsPolyBaseInstalled 適用於SQL Server 2017SQL Server 2017Applies to: SQL Server 2017SQL Server 2017.

傳回伺服器執行個體是否已安裝 PolyBase 功能。Returns whether the server instance has the PolyBase feature installed.

0 = 未安裝 PolyBase。0 = PolyBase is not installed.

1 = 已安裝 PolyBase。1 = PolyBase is installed.

基底資料類型:intBase data type: int
IsSingleUserIsSingleUser 伺服器處於單一使用者模式。Server is in single-user mode.

1 = 單一使用者。1 = Single user.

0 = 非單一使用者0 = Not single user

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.

基底資料類型:intBase data type: int
IsXTPSupportedIsXTPSupported 適用於:SQL Server (SQL Server 2014 (12.x)SQL Server 2014 (12.x)SQL Server 2017SQL Server 2017)、SQL DatabaseSQL DatabaseApplies to: SQL Server (SQL Server 2014 (12.x)SQL Server 2014 (12.x) through SQL Server 2017SQL Server 2017), SQL DatabaseSQL Database.

伺服器支援 In-Memory OLTP。Server supports In-Memory OLTP.

1= 伺服器支援 In-Memory OLTP。1= Server supports In-Memory OLTP.

0= 伺服器不支援 In-Memory OLTP。0= Server does not supports In-Memory OLTP.

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.

基底資料類型:intBase data type: int
LCIDLCID Windows 的定序地區設定識別碼 (LCID)。Windows locale identifier (LCID) of the collation.

基底資料類型:intBase data type: int
LicenseTypeLicenseType 未使用的。Unused. SQL ServerSQL Server 產品未保留或維護的授權資訊。License information is not preserved or maintained by the SQL ServerSQL Server product. 一律傳回 DISABLED。Always returns DISABLED.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
MachineNameMachineName 執行伺服器執行個體的 Windows 電腦名稱。Windows computer name on which the server instance is running.

如果是叢集執行個體,也就是在 Microsoft Cluster Service 虛擬伺服器上執行的 SQL ServerSQL Server 執行個體,便會傳回虛擬伺服器名稱。For a clustered instance, an instance of SQL ServerSQL Server running on a virtual server on Microsoft Cluster Service, it returns the name of the virtual server.

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
NumLicensesNumLicenses 未使用的。Unused. SQL ServerSQL Server 產品未保留或維護的授權資訊。License information is not preserved or maintained by the SQL ServerSQL Server product. 一律傳回 NULL。Always returns NULL.

基底資料類型:intBase data type: int
ProcessIDProcessID SQL ServerSQL Server 服務的處理序識別碼。Process ID of the SQL ServerSQL Server service. 在識別哪個 Sqlservr.exe 屬於這個執行個體時,ProcessID 非常有用。ProcessID is useful in identifying which Sqlservr.exe belongs to this instance.

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.

基底資料類型:intBase data type: int
ProductBuildProductBuild 適用對象SQL Server 2014 (12.x)SQL Server 2014 (12.x) (自 2015 年 10 月開始)。Applies to: SQL Server 2014 (12.x)SQL Server 2014 (12.x) beginning October, 2015.

組建編號。The build number.
ProductBuildTypeProductBuildType 適用對象SQL Server 2012 (11.x)SQL Server 2012 (11.x) 至目前版本 (從 2015 晚期開始的更新)。Applies to: SQL Server 2012 (11.x)SQL Server 2012 (11.x) through current version in updates beginning in late 2015.

目前組建的組建類型。Type of build of the current build.

傳回下列項目之一:Returns one of the following:

OD = 特定客戶的隨選版本。OD = On Demand release a specific customer.

GDR = 透過 Windows Update 發行的一般發行版本。GDR = General Distribution Release released through windows update.

NULLNULL
= 不適用。= Not applicable.
ProductLevelProductLevel SQL ServerSQL Server 執行個體的版本層級。Level of the version of the instance of SQL ServerSQL Server.

傳回下列項目之一:Returns one of the following:

'RTM' = 原始發行版本'RTM' = Original release version

'SPn' = Service Pack 版本'SPn' = Service pack version

'CTPn', = Community Technical Preview 版本'CTPn', = Community Technology Preview version

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
ProductMajorVersionProductMajorVersion 適用對象SQL Server 2012 (11.x)SQL Server 2012 (11.x) 至目前版本 (從 2015 晚期開始的更新)。Applies to: SQL Server 2012 (11.x)SQL Server 2012 (11.x) through current version in updates beginning in late 2015.

主要版本。The major version.
ProductMinorVersionProductMinorVersion 適用對象SQL Server 2012 (11.x)SQL Server 2012 (11.x) 至目前版本 (從 2015 晚期開始的更新)。Applies to: SQL Server 2012 (11.x)SQL Server 2012 (11.x) through current version in updates beginning in late 2015.

次要版本。The minor version.
ProductUpdateLevelProductUpdateLevel 適用對象SQL Server 2012 (11.x)SQL Server 2012 (11.x) 至目前版本 (從 2015 晚期開始的更新)。Applies to: SQL Server 2012 (11.x)SQL Server 2012 (11.x) through current version in updates beginning in late 2015.

目前組建的更新層級。Update level of the current build. CU 表示累積更新。CU indicates a cumulative update.

傳回下列項目之一:Returns one of the following:

CUn = 累積更新CUn = Cumulative Update

NULLNULL
= 不適用。= Not applicable.
ProductUpdateReferenceProductUpdateReference 適用對象SQL Server 2012 (11.x)SQL Server 2012 (11.x) 至目前版本 (從 2015 晚期開始的更新)。Applies to: SQL Server 2012 (11.x)SQL Server 2012 (11.x) through current version in updates beginning in late 2015.

該版本的知識庫文章。KB article for that release.
ProductVersionProductVersion SQL ServerSQL Server 執行個體的版本,格式為 'major.minor.build.revision'。Version of the instance of SQL ServerSQL Server, in the form of 'major.minor.build.revision'.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
ResourceLastUpdateDateTimeResourceLastUpdateDateTime 傳回資源資料庫上次更新的日期和時間。Returns the date and time that the Resource database was last updated.

基底資料型別:datetimeBase data type: datetime
ResourceVersionResourceVersion 傳回版本資源資料庫。Returns the version Resource database.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
ServerNameServerName 指定的 SQL ServerSQL Server 執行個體所關聯的 Windows 伺服器和執行個體資訊。Both the Windows server and instance information associated with a specified instance of SQL ServerSQL Server.

NULL = 輸入無效,或發生錯誤。NULL = Input is not valid, or an error.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
SqlCharSetSqlCharSet 定序識別碼中的 SQL 字元集識別碼。The SQL character set ID from the collation ID.

基底資料型別:tinyintBase data type: tinyint
SqlCharSetNameSqlCharSetName 定序中的 SQL 字元集名稱。The SQL character set name from the collation.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
SqlSortOrderSqlSortOrder 定序中的 SQL 排序順序識別碼The SQL sort order ID from the collation

基底資料型別:tinyintBase data type: tinyint
SqlSortOrderNameSqlSortOrderName 定序中的 SQL 排序次序名稱。The SQL sort order name from the collation.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
FilestreamShareNameFilestreamShareName FILESTREAM 所使用之共用的名稱。The name of the share used by FILESTREAM.

NULL = 輸入無效、發生錯誤或不適用。NULL = Input is not valid, an error, or not applicable.
FilestreamConfiguredLevelFilestreamConfiguredLevel 已設定的 FILESTREAM 存取層級。The configured level of FILESTREAM access. 如需詳細資訊,請參閱檔案資料流存取層級For more information, see filestream access level.
FilestreamEffectiveLevelFilestreamEffectiveLevel 有效的 FILESTREAM 存取層級。The effective level of FILESTREAM access. 如果此層級已變更而且執行個體重新啟動或電腦重新啟動已暫止,這個值就可能會與 FilestreamConfiguredLevel 不同。This value can be different than the FilestreamConfiguredLevel if the level has changed and either an instance restart or a computer restart is pending. 如需詳細資訊,請參閱檔案資料流存取層級For more information, see filestream access level.

傳回類型Return Types

sql_variantsql_variant

RemarksRemarks

ServerName 屬性ServerName Property

SERVERPROPERTY 函式的 ServerName 屬性及 @@SERVERNAME 會傳回類似的資訊。The ServerName property of the SERVERPROPERTY function and @@SERVERNAME return similar information. ServerName 屬性提供共同組成唯一伺服器執行個體的 Windows 伺服器和執行個體名稱。The ServerName property provides the Windows server and instance name that together make up the unique server instance. @@SERVERNAME 提供目前設定的本機伺服器名稱。@@SERVERNAME provides the currently configured local server name.

如果安裝時的預設伺服器名稱沒有變更,ServerName 屬性和 @@SERVERNAME 會傳回相同的資訊。The ServerName property and @@SERVERNAME return the same information if the default server name at the time of installation has not been changed. 您可以執行下列作業來設定本機伺服器名稱:The local server name can be configured by executing the following:

EXEC sp_dropserver 'current_server_name';  
GO  
EXEC sp_addserver 'new_server_name', 'local';  
GO  

如果本機伺服器名稱已變更為不是安裝時的預設伺服器名稱,@@SERVERNAME 就會傳回新的名稱。If the local server name has been changed from the default server name at installation time, @@SERVERNAME returns the new name.

Version 屬性Version Properties

SERVERPROPERTY 函式會傳回與版本資訊相關的個別屬性,而 @@VERSION 函式則會將輸出結合成一個字串。The SERVERPROPERTY function returns individual properties that relate to the version information whereas the @@VERSION function combines the output into one string. 若您的應用程式需要個別屬性字串,您可以使用 SERVERPROPERTY 函式傳回它們,而非剖析 @@VERSION 的結果。If your application requires individual property strings, you can use the SERVERPROPERTY function to return them instead of parsing the @@VERSION results.

注意

我們了解由 SERVERPROPERTY 回報的版本屬性對於 Azure SQL Database 而言並不正確的問題。We are aware of an issue where the version properties reported by SERVERPROPERTY are incorrect for Azure SQL Database. Azure SQL Database 所執行的 SQL Server 資料庫引擎之版本,一定會領先於 SQL Server 的內部部署版本,且會包含最新的安全性修正。The version of the SQL Server database engine run by Azure SQL Database is always ahead of the on-premises version of SQL Server, and includes the latest security fixes. 這表示修補程式等級一律會與 SQL Server 的內部部署版本對等或領先,且在 SQL Server 中提供的最新功能,在 Azure SQL Database 中也會提供。This means that the patch level is always on par with or ahead of the on-premises version of SQL Server, and that the latest features available in SQL Server are available in Azure SQL Database.

若要以程式設計方式判斷引擎版本,請使用 SELECT SERVERPROPERTY('EngineEdition')。To programmatically determine the engine edition, use SELECT SERVERPROPERTY('EngineEdition'). 此查詢將針對單一資料庫/彈性集區傳回 '5',並針對 Azure SQL Database 中的受控執行個體傳回 '8'。This query will return '5' for single databases/elastic pools and '8' for managed instances in Azure SQL Database.

解決此問題之後,將會更新文件。We will update the documentation once this issue is resolved.

權限Permissions

所有使用者都可以查詢伺服器屬性。All users can query the server properties.

範例Examples

下列範例會使用 SELECT 陳述式中的 SERVERPROPERTY 函式來傳回目前 SQL ServerSQL Server 執行個體的相關資訊。The following example uses the SERVERPROPERTY function in a SELECT statement to return information about the current instance of SQL ServerSQL Server.

SELECT  
  SERVERPROPERTY('MachineName') AS ComputerName,
  SERVERPROPERTY('ServerName') AS InstanceName,  
  SERVERPROPERTY('Edition') AS Edition,
  SERVERPROPERTY('ProductVersion') AS ProductVersion,  
  SERVERPROPERTY('ProductLevel') AS ProductLevel;  
GO  

另請參閱See Also

SQL Server 2016 的版本和元件Editions and Components of SQL Server 2016