>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