Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » Meta Data FunctionsRSS Feeds

INDEXKEY_PROPERTY Function

Posted By: Sarita Patel     Category: SQL Server     Views: 2110

This article explains about INDEXKEY_PROPERTY function in sql server with examples.

INDEXKEY_PROPERTY function returns information about the index key.


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.



Example 2 : Use of INDEXKEY_PROPERTY function in select clause

SELECT INDEXKEY_PROPERTY(OBJECT_ID('Customers'),1,1,'IsDescending')

Output
0

Above example returns 0 means index column is stored in ascending order.
  
Share: 

 
 

Didn't find what you were looking for? Find more on INDEXKEY_PROPERTY Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of INDEXKEY_PROPERTY Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!