Syntax of INDEXKEY_PROPERTY Function :
INDEXKEY_PROPERTY ( table_id, index_id, key_id ,property )
table_id is an identification number of table. It is of type integer.
index_id is an identification number of index. It is of type integer.
key_id is a column position of index. It is of type integer.
property is a name of property. Below is the table containing properties, return value and description of it.
Value | Description |
ColumnId | Column ID at the key_ID position of the
index. |
IsDescending | Order in which the index column is stored. 1 = Descending
0 = Ascending |
Return type of INDEXKEY_PROPERTY function is an integer.
Examples of INDEXKEY_PROPERTY Function :
Example 1 : Use of INDEXKEY_PROPERTY function in select clause
SELECT INDEXKEY_PROPERTY(OBJECT_ID('Customers'),1,1,'ColumnId')
Output
1
Above example returns 1 means 1st column of the customers table is indexed.