You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 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.
Is an expression that contains the object identification number of the table or indexed view for which to provide index property information. *object_ID* is **int**.
37
-
38
-
*index_or_statistics_name*
39
-
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)**.
40
-
41
-
*property*
42
-
Is an expression that contains the name of the database property to return. *property* is **varchar(128)**, and can be one of these values.
43
-
37
+
38
+
#### *object_ID*
39
+
40
+
An expression that contains the object identification number of the table or indexed view for which to provide index property information. *object_ID* is **int**.
41
+
42
+
#### *index_or_statistics_name*
43
+
44
+
An expression that contains the name of the index or statistics for which to return property information. *index_or_statistics_name* is **nvarchar(128)**.
45
+
46
+
#### *property*
47
+
48
+
An expression that contains the name of the index or statistics property to return. *property* is **varchar(128)**, and can be one of these values.
49
+
44
50
> [!NOTE]
45
-
> 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.
46
-
47
-
|Property|Description|Value|
48
-
|--------------|-----------------|-----------|
49
-
|**IndexDepth**|Depth of the index.|Number of index levels.<br /><br /> NULL = XML index or input is not valid.|
50
-
|**IndexFillFactor**|Fill factor value used when the index was created or last rebuilt.|Fill factor|
51
-
|**IndexID**|Index ID of the index on a specified table or indexed view.|Index ID|
52
-
|**IsAutoStatistics**|Statistics were generated by the AUTO_CREATE_STATISTICS option of ALTER DATABASE.|1 = True<br /><br /> 0 = False or XML index.|
53
-
|**IsClustered**|Index is clustered.|1 = True<br /><br /> 0 = False or XML index.|
54
-
|**IsDisabled**|Index is disabled.|1 = True<br /><br /> 0 = False<br /><br /> NULL = Input is not valid.|
55
-
|**IsFulltextKey**|Index is the full-text and semantic indexing key for a table.|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later.<br /><br /> 1 = True<br /><br /> 0 = False or XML index.<br /><br /> NULL = Input is not valid.|
56
-
|**IsHypothetical**|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 = True<br /><br /> 0 = False or XML index<br /><br /> NULL = Input is not valid.|
57
-
|**IsPadIndex**|Index specifies space to leave open on each interior node.|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later.<br /><br /> 1 = True<br /><br /> 0 = False or XML index.|
58
-
|**IsPageLockDisallowed**|Page-locking value set by the ALLOW_PAGE_LOCKS option of ALTER INDEX.|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later.<br /><br /> 1 = Page locking is disallowed.<br /><br /> 0 = Page locking is allowed.<br /><br /> NULL = Input is not valid.|
59
-
|**IsRowLockDisallowed**|Row-locking value set by the ALLOW_ROW_LOCKS option of ALTER INDEX.|**Applies to**: [!INCLUDE[sql2008-md](../../includes/sql2008-md.md)] and later.<br /><br /> 1 = Row locking is disallowed.<br /><br /> 0 = Row locking is allowed.<br /><br /> NULL = Input is not valid.|
60
-
|**IsStatistics**|*index_or_statistics_name* is statistics created by the CREATE STATISTICS statement or by the AUTO_CREATE_STATISTICS option of ALTER DATABASE.|1 = True<br /><br /> 0 = False or XML index.|
61
-
|**IsUnique**|Index is unique.|1 = True<br /><br /> 0 = False or XML index.|
62
-
|**IsColumnstore**|Index is an xVelocity memory optimized columnstore index.|**Applies to**: [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] and later.<br /><br /> 1 = True<br /><br /> 0 = False|
63
-
|**IsOptimizedForSequentialKey**|Index has optimization for last-page inserts enabled.|**Applies to**: [!INCLUDE[sql-server-2019](../../includes/sssql19-md.md)] and later. <br><br>1 = True<br><br>0 = False|
64
-
65
-
## Return Types
66
-
**int**
67
-
68
-
## Exceptions
69
-
Returns NULL on error or if a caller does not have permission to view the object.
70
-
71
-
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](../../relational-databases/security/metadata-visibility-configuration.md).
72
-
73
-
## Examples
74
-
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 [!INCLUDE[ssSampleDBnormal](../../includes/sssampledbnormal-md.md)] database.
> Unless noted otherwise, `NULL` is returned when *property* isn't a valid property name, *object_ID* isn't a valid object ID, *object_ID* is an unsupported object type for the specified property, or the caller doesn't have permission to view the object's metadata.
52
+
53
+
| Property | Description | Value |
54
+
| --- | --- | --- |
55
+
|`IndexDepth`| Depth of the index. | Number of index levels.<br /><br />`NULL` = XML index or input isn't valid. |
56
+
|`IndexFillFactor`| Fill factor value used when the index was created or last rebuilt. | Fill factor |
57
+
|`IndexID`| Index ID of the index on a specified table or indexed view. | Index ID |
58
+
|`IsAutoStatistics`| Statistics were generated by the `AUTO_CREATE_STATISTICS` option of `ALTER DATABASE`. |`1` = True<br />`0` = False or XML index. |
59
+
|`IsClustered`| Index is clustered. |`1` = True<br />`0` = False or XML index. |
60
+
|`IsDisabled`| Index is disabled. |`1` = True<br />`0` = False<br />`NULL` = Input isn't valid. |
61
+
|`IsFulltextKey`| Index is the full-text and semantic indexing key for a table. |`1` = True<br />`0` = False or XML index.<br />`NULL` = Input isn't valid. |
62
+
|`IsHypothetical`| Index is hypothetical and can't 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` = True<br />`0` = False or XML index<br />`NULL` = Input isn't valid. |
63
+
|`IsPadIndex`| Index specifies space to leave open on each interior node. |`1` = True<br />`0` = False or XML index. |
64
+
|`IsPageLockDisallowed`| Page-locking value set by the `ALLOW_PAGE_LOCKS` option of `ALTER INDEX`. |`1` = Page locking is disallowed.<br />`0` = Page locking is allowed.<br />`NULL` = Input isn't valid. |
65
+
|`IsRowLockDisallowed`| Row-locking value set by the `ALLOW_ROW_LOCKS` option of `ALTER INDEX`. |`1` = Row locking is disallowed.<br />`0` = Row locking is allowed.<br />`NULL` = Input isn't valid. |
66
+
|`IsStatistics`|*index_or_statistics_name* is statistics created by the `CREATE STATISTICS` statement or by the `AUTO_CREATE_STATISTICS` option of `ALTER DATABASE`. |`1` = True<br />`0` = False or XML index. |
67
+
|`IsUnique`| Index is unique. |`1` = True<br />`0` = False or XML index. |
68
+
|`IsColumnstore`| Index is a memory optimized columnstore index. |`1` = True<br />`0` = False<br /><br />**Applies to**: [!INCLUDE [ssSQL11](../../includes/sssql11-md.md)] and later versions. |
69
+
|`IsOptimizedForSequentialKey`| Index has optimization for last-page inserts enabled. |`1` = True<br />`0` = False<br /><br />**Applies to**: [!INCLUDE [sql-server-2019](../../includes/sssql19-md.md)] and later versions. |
70
+
71
+
## Return types
72
+
73
+
**int**
74
+
75
+
## Exceptions
76
+
77
+
Returns `NULL` on error or if a caller doesn't have permission to view the object.
78
+
79
+
A user can only view the metadata of securables that the user owns or on which the user is granted permission. This means that metadata-emitting, built-in functions such as `INDEXPROPERTY` might return `NULL` if the user doesn't have any permission on the object. For more information, see [Metadata visibility configuration](../../relational-databases/security/metadata-visibility-configuration.md).
### A. Return properties for index on Employee table
86
+
87
+
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 [!INCLUDE [ssSampleDBnormal](../../includes/sssampledbnormal-md.md)] database.
88
+
89
+
```sql
90
+
SELECT
91
+
INDEXPROPERTY(OBJECT_ID('HumanResources.Employee'), 'PK_Employee_BusinessEntityID', 'IsClustered') AS [Is Clustered],
92
+
INDEXPROPERTY(OBJECT_ID('HumanResources.Employee'), 'PK_Employee_BusinessEntityID', 'IndexDepth') AS [Index Depth],
93
+
INDEXPROPERTY(OBJECT_ID('HumanResources.Employee'), 'PK_Employee_BusinessEntityID', 'IndexFillFactor') AS [Fill Factor];
0 commit comments