INDEXPROPERTY (Transact-SQL)
Returns the named index or statistics property value of a specified table identification number, index or statistics name, and property name. Returns NULL for XML indexes.
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. 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. For more information, see Metadata Visibility Configuration and Troubleshooting Metadata Visibility.
The following example returns the values for the IsClustered, IndexDepth, and IndexFillFactor properties for the PK_Employee_EmployeeID index of the Employee table.
USE AdventureWorks;
GO
SELECT
INDEXPROPERTY(OBJECT_ID('HumanResources.Employee'),
'PK_Employee_EmployeeID','IsClustered')AS [Is Clustered],
INDEXPROPERTY(OBJECT_ID('HumanResources.Employee'),
'PK_Employee_EmployeeID','IndexDepth') AS [Index Depth],
INDEXPROPERTY(OBJECT_ID('HumanResources.Employee'),
'PK_Employee_EmployeeID','IndexFillFactor') AS [Fill Factor];
GO
Here is the result set:
Is Clustered Index Depth Fill Factor ------------ ----------- ----------- 1 2 0 (1 row(s) affected)
