DATABASEPROPERTYEX (Transact-SQL)DATABASEPROPERTYEX (Transact-SQL)

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

針對 SQL ServerSQL Server 中的指定資料庫,此函式會傳回指定資料庫選項或屬性的目前設定。For a specified database in SQL ServerSQL Server, this function returns the current setting of the specified database option or property.

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

語法Syntax

DATABASEPROPERTYEX ( database , property )  

引數Arguments

資料庫database
指定資料庫名稱的運算式,其 DATABASEPROPERTYEX 會傳回具名屬性資訊。An expression specifying the name of the database for which DATABASEPROPERTYEX will return the named property information. database 具有 nvarchar(128) 資料類型。database has an nvarchar(128) data type.

若是 SQL DatabaseSQL DatabaseDATABASEPROPERTYEX 需要目前資料庫的名稱。For SQL DatabaseSQL Database, DATABASEPROPERTYEX requires the name of the current database. 如果指定了不同的資料庫名稱,它會對所有屬性傳回 NULL。It returns NULL for all properties if given a different database name.

propertyproperty
指定要傳回之資料庫屬性名稱的運算式。An expression specifying the name of the database property to return. property 具有 varchar(128) 資料類型,並支援此資料表中的其中一個值:property has a varchar(128) data type, and supports one of the values in this table:

注意

如果資料庫尚未啟動,且 DATABASEPROPERTYEX 透過直接存取資料庫來擷取這些值,而不是從中繼資料擷取,則呼叫 DATABASEPROPERTYEX 會傳回 NULL。If the database has not yet started, calls to DATABASEPROPERTYEX will return NULL if DATABASEPROPERTYEX retrieves those values by direct database access, instead of retrieval from metadata. AUTO_CLOSE 設定為 ON 或已離線的資料庫會定義為「未啟動」。A database with AUTO_CLOSE set to ON, or otherwise offline, is defined as 'not started.'

屬性Property DescriptionDescription 傳回的值Value returned
定序Collation 資料庫的預設定序名稱。Default collation name for the database. 定序名稱Collation name

NULL:資料庫未啟動。NULL: Database is not started.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
ComparisonStyleComparisonStyle Windows 的定序比較樣式。The Windows comparison style of the collation. 使用下列樣式值為完成的 ComparisonStyle 值建立點陣圖:Use the following style values to build a bitmap for the finished ComparisonStyle value:

忽略大小寫:1Ignore case : 1

忽略腔調字:2Ignore accent : 2

忽略假名:65536Ignore Kana : 65536

忽略寬度:131072Ignore width : 131072



例如,預設值 196609 是結合「忽略大小寫」、「忽略假名」和「忽略寬度」等選項的結果。For example, the default of 196609 is the result of combining the Ignore case, Ignore Kana, and Ignore width options.
傳回比較樣式。Returns the comparison style.

所有的二進位定序皆傳回 0。Returns 0 for all binary collations.

基底資料類型:intBase data type: int
版本Edition 資料庫版本或服務層。The database edition or service tier. 適用於Azure SQL DatabaseAzure SQL DatabaseSQL 資料倉儲SQL Data WarehouseApplies to: Azure SQL DatabaseAzure SQL Database, SQL 資料倉儲SQL Data Warehouse.



一般用途General Purpose

業務關鍵Business Critical

[基本]Basic

StandardStandard

PremiumPremium

系統 (適用於 master 資料庫)System (for master database)

NULL:資料庫未啟動。NULL: Database is not started.

基底資料型別:nvarchar(64)Base data type: nvarchar(64)
IsAnsiNullDefaultIsAnsiNullDefault 資料庫遵照允許 Null 值的 ISO 規則。Database follows ISO rules for allowing null values. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsAnsiNullsEnabledIsAnsiNullsEnabled 所有對於 Null 的比較,都會得出「未知」。All comparisons to a null evaluate to unknown. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsAnsiPaddingEnabledIsAnsiPaddingEnabled 字串在進行比較或插入處理之前,先填補至相同的長度。Strings are padded to the same length before comparison or insert. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsAnsiWarningsEnabledIsAnsiWarningsEnabled 當發生標準錯誤狀況時,SQL Server 會發出錯誤或警告訊息。SQL Server issues error or warning messages when standard error conditions occur. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsArithmeticAbortEnabledIsArithmeticAbortEnabled 在查詢執行期間,當發生溢位或除以零的錯誤時,查詢會停止。Queries end when an overflow or divide-by-zero error occurs during query execution. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsAutoCloseIsAutoClose 在最後一個使用者結束之後,資料庫完整關機並釋出資源。Database shuts down cleanly and frees resources after the last user exits. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsAutoCreateStatisticsIsAutoCreateStatistics 查詢最佳化工具會視需要建立單一資料行統計資料來改善查詢效能。Query optimizer creates single-column statistics, as required, to improve query performance. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsAutoCreateStatisticsIncrementalIsAutoCreateStatisticsIncremental 自動建立的單一資料行統計資料會累加 (如果可能)。Auto-created single column statistics are incremental when possible. 適用於SQL Server 2014 (12.x)SQL Server 2014 (12.x)SQL Server 2017SQL Server 2017Applies to: SQL Server 2014 (12.x)SQL Server 2014 (12.x) through SQL Server 2017SQL Server 2017.

1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsAutoShrinkIsAutoShrink 資料庫檔案是自動定期壓縮的候選項。Database files are candidates for automatic periodic shrinking. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsAutoUpdateStatisticsIsAutoUpdateStatistics 當查詢使用可能已過期的現有統計資料時,查詢最佳化工具就會更新這些統計資料。When a query uses potentially out-of-date existing statistics, the query optimizer updates those statistics. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Input not valid

基底資料類型:intBase data type: int
IsCloneIsClone 資料庫僅為使用 DBCC CLONEDATABASE 所建立之使用者資料庫的結構描述和統計資料複本。Database is a schema- and statistics-only copy of a user database created with DBCC CLONEDATABASE. 如需詳細資訊,請參閱 Microsoft 支援服務文章See Microsoft Support Article for more information. 適用於SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP2 至 SQL Server 2017SQL Server 2017Applies to: SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP2 through SQL Server 2017SQL Server 2017.

1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsCloseCursorsOnCommitEnabledIsCloseCursorsOnCommitEnabled 當交易認可時,所有開啟的資料指標都會關閉。When a transaction commits, all open cursors will close. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsFulltextEnabledIsFulltextEnabled 資料庫已啟用全文檢索和語意索引。Database is enabled for full-text and semantic indexing. 適用於SQL Server 2008SQL Server 2008SQL Server 2017SQL Server 2017Applies to: SQL Server 2008SQL Server 2008 through SQL Server 2017SQL Server 2017.



1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Input not valid

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

注意: 此屬性的值現在沒有任何作用。Note: The value of this property now has no effect. 使用者資料庫一定會啟用全文檢索搜尋。User databases are always enabled for full-text search. 未來的 SQL ServerSQL Server 版本將會移除這個屬性。A future release of SQL ServerSQL Server will remove this property. 請勿在新的開發工作中使用此屬性,並且盡快修改使用此屬性的應用程式。Do not use this property in new development work, and modify applications that currently use this property as soon as possible.
IsInStandByIsInStandBy 資料庫在線上唯讀,允許還原記錄。Database is online as read-only, with restore log allowed. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsLocalCursorsDefaultIsLocalCursorsDefault 資料指標宣告預設為 LOCAL。Cursor declarations default to LOCAL. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsMemoryOptimizedElevateToSnapshotEnabledIsMemoryOptimizedElevateToSnapshotEnabled 當工作階段設定 TRANSACTION ISOLATION LEVEL 設為 READ COMMITTED、READ UNCOMMITTED 或較低的隔離等級時,會使用 SNAPSHOT 隔離存取經記憶體最佳化的資料表。Memory-optimized tables are accessed using SNAPSHOT isolation, when the session setting TRANSACTION ISOLATION LEVEL is set to READ COMMITTED, READ UNCOMMITTED, or a lower isolation level. 適用於SQL Server 2014 (12.x)SQL Server 2014 (12.x)SQL Server 2017SQL Server 2017Applies to: SQL Server 2014 (12.x)SQL Server 2014 (12.x) through SQL Server 2017SQL Server 2017.



1:TRUE1: TRUE

0:FALSE0: FALSE

基底資料類型:intBase data type: int
IsMergePublishedIsMergePublished SQL ServerSQL Server 支援合併式複寫的資料庫資料表發行集 (若已安裝複寫功能)。supports database table publication for merge replication, if replication is installed. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsNullConcatIsNullConcat Null 串連運算元產生 NULL。Null concatenation operand yields NULL. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsNumericRoundAbortEnabledIsNumericRoundAbortEnabled 當運算式發生遺失有效位數的情形時,則產生錯誤。Errors are generated when a loss of precision occurs in expressions. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsParameterizationForcedIsParameterizationForced PARAMETERIZATION 資料庫 SET 選項是 FORCED。PARAMETERIZATION database SET option is FORCED. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input
IsQuotedIdentifiersEnabledIsQuotedIdentifiersEnabled 識別碼允許有雙引號。Double quotation marks on identifiers are allowed. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsPublishedIsPublished 若已安裝複寫功能,SQL ServerSQL Server 支援快照集或異動複寫的資料庫資料表發行集。If replication is installed, SQL ServerSQL Server supports database table publication for snapshot or transactional replication. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsRecursiveTriggersEnabledIsRecursiveTriggersEnabled 啟用觸發程序的遞迴引發。Recursive firing of triggers is enabled. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsSubscribedIsSubscribed 將資料庫訂閱到發行集中。Database is subscribed to a publication. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsSyncWithBackupIsSyncWithBackup 該資料庫是已發行的資料庫或散發資料庫,並支援在不干擾異動複寫的情況下進行還原。The database is either a published database or a distribution database, and it supports a restore that will not disrupt transactional replication. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsTornPageDetectionEnabledIsTornPageDetectionEnabled SQL Server Database EngineSQL Server Database Engine 偵測到因為斷電或其他系統失效所造成的不完全 I/O 作業。The SQL Server Database EngineSQL Server Database Engine detects incomplete I/O operations caused by power failures or other system outages. 1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsVerifiedCloneIsVerifiedClone 資料庫僅為使用 DBCC CLONEDATABASE 之 WITH VERIFY_CLONEDB 選項所建立之使用者資料庫的結構描述和統計資料複本。Database is a schema- and statistics- only copy of a user database, created using the WITH VERIFY_CLONEDB option of DBCC CLONEDATABASE. 如需詳細資訊,請參閱此 Microsoft 支援服務文章See this Microsoft Support Article for more information. 適用於:從 SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP2 開始。Applies to: Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP2.



1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效NULL: Invalid input

基底資料類型:intBase data type: int
IsXTPSupportedIsXTPSupported 指出資料庫是否支援記憶體內部 OLTP,即建立及使用經記憶體最佳化的資料表和原生編譯模組。Indicates whether the database supports In-Memory OLTP, i.e., creation and use of memory-optimized tables and natively compiled modules.

特定於 SQL ServerSQL ServerSpecific to SQL ServerSQL Server:

IsXTPSupported 是獨立於任何建立記憶體內部 OLTP 物件所必須之 MEMORY_OPTIMIZED_DATA 檔案群組的存在之外。IsXTPSupported is independent of the existence of any MEMORY_OPTIMIZED_DATA filegroup, which is required for creating In-Memory OLTP objects.
適用於SQL ServerSQL Server (SQL Server 2016 (13.x)SQL Server 2016 (13.x)SQL Server 2017SQL Server 2017),以及 Azure SQL DatabaseAzure SQL DatabaseApplies to: SQL ServerSQL Server (SQL Server 2016 (13.x)SQL Server 2016 (13.x) through SQL Server 2017SQL Server 2017), and Azure SQL DatabaseAzure SQL Database.

1:TRUE1: TRUE

0:FALSE0: FALSE

NULL:輸入無效、發生錯誤或不適用NULL: Invalid input, an error, or not applicable

基底資料類型:intBase data type: int
LastGoodCheckDbTimeLastGoodCheckDbTime 最後一個成功 DBCC CHECKDB 在指定的資料庫上執行的日期和時間。1 如果 DBCC CHECKDB 尚未在資料庫上執行,則回傳回 1900-01-01 00:00:00.000。The date and time of the last successful DBCC CHECKDB that ran on the specified database.1 If DBCC CHECKDB has not been run on a database, 1900-01-01 00:00:00.000 is returned. 適用於:從 SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP2 開始。Applies to: Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP2.

日期時間值A datetime value

NULL:輸入無效NULL: Invalid input

基底資料型別:datetimeBase data type: datetime
LCIDLCID Windows 的定序地區設定識別碼 (LCID)。The collation Windows locale identifier (LCID). LCID 值 (十進位格式)。LCID value (in decimal format).

基底資料類型:intBase data type: int
MaxSizeInBytesMaxSizeInBytes 資料庫的大小上限 (以位元組為單位)。Maximum database size, in bytes. 適用於Azure SQL DatabaseAzure SQL DatabaseSQL 資料倉儲SQL Data WarehouseApplies to: Azure SQL DatabaseAzure SQL Database, SQL 資料倉儲SQL Data Warehouse.



10737418241073741824

53687091205368709120

1073741824010737418240

2147483648021474836480

3221225472032212254720

4294967296042949672960

5368709120053687091200

NULL:資料庫未啟動NULL: Database is not started

基底資料型別:bigintBase data type: bigint
復原Recovery 資料庫復原模式Database recovery model FULL:完整復原模式FULL: Full recovery model

BULK_LOGGED:大量記錄模式BULK_LOGGED: Bulk logged model

SIMPLE:簡單復原模式SIMPLE: Simple recovery model

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
ServiceObjectiveServiceObjective 描述 SQL DatabaseSQL DatabaseSQL 資料倉儲SQL Data Warehouse 中資料庫的效能層級。Describes the performance level of the database in SQL DatabaseSQL Database or SQL 資料倉儲SQL Data Warehouse. 它有下列幾種:One of the following:

Null:資料庫尚未啟動Null: database not started

共用 (適用於 Web/Business 版本)Shared (for Web/Business editions)

[基本]Basic

S0S0

S1S1

S2S2

S3S3

P1P1

P2P2

P3P3

ElasticPoolElasticPool

系統 (適用於 master 資料庫)System (for master DB)

基底資料型別:nvarchar(32)Base data type: nvarchar(32)
ServiceObjectiveIdServiceObjectiveId SQL DatabaseSQL Database 中服務目標的識別碼。The id of the service objective in SQL DatabaseSQL Database. 識別服務目標的 uniqueidentifieruniqueidentifier that identifies the service objective.
SQLSortOrderSQLSortOrder 舊版 SQL Server 中所支援的 SQL ServerSQL Server 排序順序識別碼。SQL ServerSQL Server sort order ID supported in earlier versions of SQL Server. 0:資料庫使用 Windows 定序0: Database uses Windows collation

>0:SQL ServerSQL Server 排序順序識別碼>0: SQL ServerSQL Server sort order ID

NULL:輸入無效或資料庫尚未啟動NULL: Invalid input, or database has not started

基底資料型別:tinyintBase data type: tinyint
[狀態]Status 資料庫狀態。Database status. ONLINE:資料庫可用於查詢。ONLINE: Database is available for query.

注意: 當資料庫開啟且尚未復原時,可能會傳回 ONLINE 狀態。Note: The ONLINE status may be returned while the database opens and has not yet recovered. 若要識別資料庫可接受連線的時間,請查詢 DATABASEPROPERTYEX 的 Collation 屬性。To identify when a database can accept connections, query the Collation property of DATABASEPROPERTYEX. 當資料庫定序傳回非 Null 值時,表示資料庫可接受連接。The database can accept connections when the database collation returns a non-null value. 對於 AlwaysOn 資料庫,可查詢 sys.dm_hadr_database_replica_states 的 database_state 或 database_state_desc 資料行。For Always On databases, query the database_state or database_state_desc columns of sys.dm_hadr_database_replica_states.

OFFLINE:資料庫明確離線。OFFLINE: Database was explicitly taken offline.

RESTORING:資料庫還原已啟動。RESTORING: Database restore has started.

RECOVERING:資料庫復原已啟動,但資料庫尚未準備好提供查詢。RECOVERING: Database recovery has started and the database is not yet ready for queries.

SUSPECT:資料庫未復原。SUSPECT: Database did not recover.

EMERGENCY:資料庫處於緊急、唯讀的狀態。EMERGENCY: Database is in an emergency, read-only state. 存取限於系統管理員 (sysadmin) 成員Access is restricted to sysadmin members

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
UpdateabilityUpdateability 指出資料是否可以修改。Indicates whether data can be modified. READ_ONLY:資料庫支援資料讀取,但不支援資料修改。READ_ONLY: Database supports data reads but not data modifications.

READ_WRITE:資料庫支援資料讀取和修改。READ_WRITE: Database supports data reads and modifications.

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
UserAccessUserAccess 指定那些使用者可以存取資料庫。Indicates which users can access the database. SINGLE_USER:一次只有一個 db_owner、資料庫建立者 (dbcreator) 或系統管理員使用者SINGLE_USER: Only one db_owner, dbcreator, or sysadmin user at a time

RESTRICTED_USER:只有 db_owner、資料庫建立者 (dbcreator) 或系統管理員角色的成員RESTRICTED_USER: Only members of db_owner, dbcreator, or sysadmin roles

MULTI_USER:所有使用者MULTI_USER: All users

基底資料型別:nvarchar(128)Base data type: nvarchar(128)
VersionVersion 建立資料庫所用 SQL ServerSQL Server 程式碼的內部版本號碼。Internal version number of the SQL ServerSQL Server code with which the database was created. 僅供參考之用。Identified for informational purposes only. 不支援。Not supported. 我們無法保證未來的相容性。Future compatibility is not guaranteed. 版本號碼:資料庫是開啟的。Version number: Database is open.

NULL:資料庫尚未啟動。NULL: Database has not started.

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

注意

1 對於屬於可用性群組一部分的資料庫,LastGoodCheckDbTime 將會傳回最後一個成功 DBCC CHECKDB 在主要複本上執行的日期和時間,而不論您是從哪一個複本執行命令。1 For databases that are part of an Availability Group, LastGoodCheckDbTime will return the date and time of the last successful DBCC CHECKDB that ran on the primary replica, regardless of which replica you run the command from.

傳回類型Return types

sql_variantsql_variant

例外狀況Exceptions

發生錯誤或呼叫端沒有檢視物件的權限時,會傳回 NULL。Returns NULL on error, or if a caller does not have permission to view the object.

SQL ServerSQL Server 中,使用者只能檢視使用者擁有或被授與某些權限之安全性實體的中繼資料。In SQL ServerSQL Server, a user can only view the metadata of securables that the user owns or on which the user has been granted permission. 這表示,如果使用者沒有物件的權限,則發出中繼資料的內建函式 (例如 OBJECT_ID) 可能會傳回 NULL。This means that metadata-emitting, built-in functions such as OBJECT_ID may return NULL if the user has no permissions on the object. 如需詳細資訊,請參閱中繼資料可見性設定See Metadata Visibility Configuration for more information.

RemarksRemarks

DATABASEPROPERTYEX 一次只傳回一個屬性設定。DATABASEPROPERTYEX returns only one property setting at a time. 若要顯示多個屬性設定,請使用 sys.databases 目錄檢視。To display multiple property settings, use the sys.databases catalog view.

範例Examples

A.A. 擷取 AUTO_SHRINK 資料庫選項的狀態Retrieving the status of the AUTO_SHRINK database option

此範例會傳回 AdventureWorks 資料庫 AUTO_SHRINK 資料庫選項的狀態。This example returns the status of the AUTO_SHRINK database option for the AdventureWorks database.

SELECT DATABASEPROPERTYEX('AdventureWorks2014', 'IsAutoShrink');  

以下為結果集:Here is the result set. 這表示 AUTO_SHRINK 是關閉狀態。This indicates that AUTO_SHRINK is off.

------------------  
0  

B.B. 擷取資料庫的預設定序Retrieving the default collation for a database

此範例會傳回 AdventureWorks 資料庫的多個屬性。This example returns several attributes of the AdventureWorks database.

SELECT   
    DATABASEPROPERTYEX('AdventureWorks2014', 'Collation') AS Collation,  
    DATABASEPROPERTYEX('AdventureWorks2014', 'Edition') AS Edition,  
    DATABASEPROPERTYEX('AdventureWorks2014', 'ServiceObjective') AS ServiceObjective,  
    DATABASEPROPERTYEX('AdventureWorks2014', 'MaxSizeInBytes') AS MaxSizeInBytes  

以下為結果集:Here is the result set.

Collation                     Edition        ServiceObjective  MaxSizeInBytes  
----------------------------  -------------  ----------------  --------------  
SQL_Latin1_General_CP1_CI_AS  DataWarehouse  DW1000            5368709120  

另請參閱See also

ALTER DATABASE (Transact-SQL)ALTER DATABASE (Transact-SQL)
資料庫狀態Database States
sys.databases (Transact-SQL)sys.databases (Transact-SQL)
sys.database_files (Transact-SQL)sys.database_files (Transact-SQL)
SERVERPROPERTY (Transact-SQL)SERVERPROPERTY (Transact-SQL)