Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Dear Friends,

How to find index column in a table.
What is use of making multiple index.

Regards,
AP
Posted

Here is the sample code to fetch the multiple index columns from 'Employee' table of 'Company' database.

SQL
USE Company;
GO
EXEC sp_helpindex 'Employee'
GO
 
Share this answer
 
Comments
Prosan 20-Jun-12 0:56am    
very good answer my 5
How to find index column in a table.
Get Information of Index of Tables and Indexed Columns[^]
How to Get All Indexes List With Involved Columns Name[^]

What is use of making multiple index.
The optimizer can only use only one index in a query, so if you create five indexes, the optimizer will pick the best one to use, and disregard the rest.
If you create one index with five fields, it will use as much of the index as it can. If you restrict on the first field of the index, it will use only that part of the index. If you restrict on the first three fields, it will use all three parts, resulting in better performance than just having an index on the first field.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900