Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
YAQ on Indexes
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01546198
Message ID:
01546199
Views:
44
>Hi,
>
>I am changing the index tags for many SQL Server tables and would like to understand something.
>
>Here is an example and a question. Say I have a table with a Char field/column (CUSTOMER_ID) and an Integer field/column (SITE_NO). I create a unique index key on thee two column; as the following:
>
>CREATE UNIQUE INDEX PX_CUST_SITE ON MyTable (customer_id, site_no )
>
>When a SQL Select will be executed against either one of these fields, customer_id or site_no, will SQL Server use this index? Or I need to create to more separate indexes, one on CUSTOMER_ID and another on SITE_NO?
>TIA

This index will be used if you query by both Customer_id and site_no, or when you query by customer_id. It will not be used when you query by site_no alone.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform