INDEXPROPERTY (Transact-SQL)INDEXPROPERTY (Transact-SQL)
適用対象:Applies to: SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
Azure SQL データベースAzure SQL Database
Azure SQL データベースAzure SQL Database
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
Parallel Data WarehouseParallel Data Warehouse
Parallel Data WarehouseParallel Data Warehouse
SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
Azure SQL データベースAzure SQL Database
Azure SQL データベースAzure SQL Database
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
Parallel Data WarehouseParallel Data Warehouse
Parallel Data WarehouseParallel Data Warehouse
指定されたテーブル ID 番号、インデックス名または統計名、およびプロパティ名の指定されたインデックスまたは統計プロパティ値を返します。Returns the named index or statistics property value of a specified table identification number, index or statistics name, and property name. XML インデックスに対して NULL を返します。Returns NULL for XML indexes.
Transact-SQL 構文表記規則
Transact-SQL Syntax Conventions
構文Syntax
INDEXPROPERTY ( object_ID , index_or_statistics_name , property )
注意
SQL Server 2014 以前の Transact-SQL 構文を確認するには、以前のバージョンのドキュメントを参照してください。To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.
引数Arguments
object_IDobject_ID
インデックス プロパティ情報の提供元となるテーブルまたはインデックス付きビューのオブジェクト ID 番号を含む式です。Is an expression that contains the object identification number of the table or indexed view for which to provide index property information. object_ID は int です。object_ID is int.
index_or_statistics_nameindex_or_statistics_name
返されるプロパティ情報の基となるインデックスまたは統計の名前を含む式です。Is an expression that contains the name of the index or statistics for which to return property information. index_or_statistics_name is nvarchar(128).index_or_statistics_name is nvarchar(128).
propertyproperty
返されるデータベース プロパティの名前を含む式です。Is an expression that contains the name of the database property to return. property のデータ型は varchar(128) で、次のいずれかの値を指定できます。property is varchar(128), and can be one of these values.
注意
property が有効なプロパティ名でない場合、object_ID が有効なオブジェクト ID でない場合、object_ID が指定したプロパティでサポートされていないオブジェクトの種類であった場合、または呼び出し側にオブジェクトのメタデータを表示する権限がない場合は、特に指定のない限り、NULL が返されます。Unless noted otherwise, NULL is returned when property is not a valid property name, object_ID is not a valid object ID, object_ID is an unsupported object type for the specified property, or the caller does not have permission to view the object's metadata.
プロパティProperty | 説明Description | 値Value |
---|---|---|
IndexDepthIndexDepth | インデックスの深さです。Depth of the index. | インデックス レベルの数です。Number of index levels. NULL = XML インデックスまたは無効な入力NULL = XML index or input is not valid. |
IndexFillFactorIndexFillFactor | インデックスが作成されたとき、または最後に再構築されたときに使用された FILL FACTOR 値です。Fill factor value used when the index was created or last rebuilt. | FILL FACTORFill factor |
IndexIDIndexID | 指定のテーブルまたはインデックス付きビュー上のインデックスの ID です。Index ID of the index on a specified table or indexed view. | インデックス IDIndex ID |
IsAutoStatisticsIsAutoStatistics | ALTER DATABASE の AUTO_CREATE_STATISTICS オプションによって生成された統計です。Statistics were generated by the AUTO_CREATE_STATISTICS option of ALTER DATABASE. | 1 = True1 = True 0 = False または XML インデックス。0 = False or XML index. |
IsClusteredIsClustered | インデックスはクラスター化されています。Index is clustered. | 1 = True1 = True 0 = False または XML インデックス。0 = False or XML index. |
IsDisabledIsDisabled | インデックスは無効です。Index is disabled. | 1 = True1 = True 0 = False0 = False NULL = 入力は無効です。NULL = Input is not valid. |
IsFulltextKeyIsFulltextKey | インデックスは、テーブルのフルテキストおよびセマンティック インデックス作成のキーです。Index is the full-text and semantic indexing key for a table. | 適用対象: SQL Server 2008SQL Server 2008 以降。Applies to: SQL Server 2008SQL Server 2008 and later. 1 = True1 = True 0 = False または XML インデックス。0 = False or XML index. NULL = 入力は無効です。NULL = Input is not valid. |
IsHypotheticalIsHypothetical | インデックスは仮想的であり、データへのアクセス パスとして直接使用することはできません。Index is hypothetical and cannot be used directly as a data access path. 仮想インデックスは、列レベルの統計を保持し、データベース エンジン チューニング アドバイザーによって管理および使用されます。Hypothetical indexes hold column-level statistics and are maintained and used by Database Engine Tuning Advisor. | 1 = True1 = True 0 = False または XML インデックス0 = False or XML index NULL = 入力は無効です。NULL = Input is not valid. |
IsPadIndexIsPadIndex | インデックスは各内部ノード上で空けておく領域を指定します。Index specifies space to leave open on each interior node. | 適用対象: SQL Server 2008SQL Server 2008 以降。Applies to: SQL Server 2008SQL Server 2008 and later. 1 = True1 = True 0 = False または XML インデックス。0 = False or XML index. |
IsPageLockDisallowedIsPageLockDisallowed | ALTER INDEX の ALLOW_PAGE_LOCKS オプションによって設定されたページ ロックの値です。Page-locking value set by the ALLOW_PAGE_LOCKS option of ALTER INDEX. | 適用対象: SQL Server 2008SQL Server 2008 以降。Applies to: SQL Server 2008SQL Server 2008 and later. 1 = ページ ロックの禁止1 = Page locking is disallowed. 0 = ページ ロックの許可0 = Page locking is allowed. NULL = 入力は無効です。NULL = Input is not valid. |
IsRowLockDisallowedIsRowLockDisallowed | ALTER INDEX の ALLOW_ROW_LOCKS オプションによって設定された行ロックの値です。Row-locking value set by the ALLOW_ROW_LOCKS option of ALTER INDEX. | 適用対象: SQL Server 2008SQL Server 2008 以降。Applies to: SQL Server 2008SQL Server 2008 and later. 1 = 行ロックの禁止。1 = Row locking is disallowed. 0 = 行ロックの許可0 = Row locking is allowed. NULL = 入力は無効です。NULL = Input is not valid. |
IsStatisticsIsStatistics | index_or_statistics_name は、CREATE STATISTICS ステートメントまたは ALTER DATABASE の AUTO_CREATE_STATISTICS オプションによって作成された統計です。index_or_statistics_name is statistics created by the CREATE STATISTICS statement or by the AUTO_CREATE_STATISTICS option of ALTER DATABASE. | 1 = True1 = True 0 = False または XML インデックス。0 = False or XML index. |
IsUniqueIsUnique | インデックスは一意です。Index is unique. | 1 = True1 = True 0 = False または XML インデックス。0 = False or XML index. |
IsColumnstoreIsColumnstore | インデックスは xVelocity メモリ最適化列ストア インデックスです。Index is an xVelocity memory optimized columnstore index. | 適用対象: SQL Server 2012 (11.x)SQL Server 2012 (11.x) 以降。Applies to: SQL Server 2012 (11.x)SQL Server 2012 (11.x) and later. 1 = True1 = True 0 = False0 = False |
IsOptimizedForSequentialKeyIsOptimizedForSequentialKey | インデックスには、最終ページ挿入が有効になっている場合の最適化があります。Index has optimization for last-page inserts enabled. | 適用対象: SQL Server 2019 (15.x)SQL Server 2019 (15.x) 以降。Applies to: SQL Server 2019 (15.x)SQL Server 2019 (15.x) and later. 1 = True1 = True 0 = False0 = False |
戻り値の型Return Types
intint
例外Exceptions
エラーが発生した場合、または呼び出し元にオブジェクトの表示権限がない場合は、NULL が返されます。Returns NULL on error or if a caller does not have permission to view the object.
ユーザーが所有しているか、または権限を与えられている、セキュリティ保護可能なリソースのメタデータのみを表示できます。A user can only view the metadata of securables that the user owns or on which the user has been granted permission. つまり、オブジェクトに対する権限がユーザーに与えられていない場合、メタデータを生成する組み込み関数 (INDEXPROPERTY など) が NULL を返す可能性があります。This means that metadata-emitting, built-in functions such as INDEXPROPERTY may return NULL if the user does not have any permission on the object. 詳細については、「 Metadata Visibility Configuration」を参照してください。For more information, see Metadata Visibility Configuration.
例Examples
次の例では、AdventureWorks2012AdventureWorks2012 データベースにある Employee
テーブルの PK_Employee_BusinessEntityID
インデックスについて IsClustered、IndexDepth、および IndexFillFactor プロパティの値を返します。The following example returns the values for the IsClustered, IndexDepth, and IndexFillFactor properties for the PK_Employee_BusinessEntityID
index of the Employee
table in the AdventureWorks2012AdventureWorks2012 database.
SELECT
INDEXPROPERTY(OBJECT_ID('HumanResources.Employee'),
'PK_Employee_BusinessEntityID','IsClustered')AS [Is Clustered],
INDEXPROPERTY(OBJECT_ID('HumanResources.Employee'),
'PK_Employee_BusinessEntityID','IndexDepth') AS [Index Depth],
INDEXPROPERTY(OBJECT_ID('HumanResources.Employee'),
'PK_Employee_BusinessEntityID','IndexFillFactor') AS [Fill Factor];
結果セットは次のようになります。Here is the result set:
Is Clustered Index Depth Fill Factor
------------ ----------- -----------
1 2 0
(1 row(s) affected)
例: Azure Synapse AnalyticsAzure Synapse Analytics、Parallel Data WarehouseParallel Data WarehouseExamples: Azure Synapse AnalyticsAzure Synapse Analytics and Parallel Data WarehouseParallel Data Warehouse
次の例では、FactResellerSales
テーブルのインデックスの 1 つのプロパティを調べます。The following example examines the properties of one of the indexes on the FactResellerSales
table.
-- Uses AdventureWorks
SELECT
INDEXPROPERTY(OBJECT_ID('dbo.FactResellerSales'),
'ClusteredIndex_6d10fa223e5e4c1fbba087e29e16a7a2','IsClustered') AS [Is Clustered],
INDEXPROPERTY(OBJECT_ID('dbo.FactResellerSales'),
'ClusteredIndex_6d10fa223e5e4c1fbba087e29e16a7a2','IsColumnstore') AS [Is Columnstore Index],
INDEXPROPERTY(OBJECT_ID('dbo.FactResellerSales'),
'ClusteredIndex_6d10fa223e5e4c1fbba087e29e16a7a2','IndexFillFactor') AS [Fill Factor];
GO
参照See Also
CREATE INDEX (Transact-SQL) CREATE INDEX (Transact-SQL)
統計 Statistics
sys.indexes (Transact-SQL) sys.indexes (Transact-SQL)
sys.index_columns (Transact-SQL) sys.index_columns (Transact-SQL)
sys.stats (Transact-SQL) sys.stats (Transact-SQL)
sys.stats_columns (Transact-SQL)sys.stats_columns (Transact-SQL)