Logo 
Search:

SQL Server Articles

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

INDEX_COL Function

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

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

INDEX_COL function is used to get indexed column name.


Syntax of INDEX_COL Function :

INDEX_COL ( 'table', index_id, key_id )

table is a name of the table.

index_id is an id of the index.

key_id is an id of the key.

Return type of INDEX_COL function is nvarchar(256).




Examples of INDEX_COL Function :

Example 1 : Use of INDEX_COL function in select clause

SELECT INDEX_COL('Customers', 1, 1)

Output
CustomerID

Above example returns column name which is indexed in customers table.
  
Share: 


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

Sarita Patel
Sarita Patel author of INDEX_COL 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!