Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 5123

Order of columns in an index

$
0
0
Hi,
I have a table with  columns, FirstName, Middle Name and Last Name.
the clustered index is on (FirstName, MiddleName ,LastName).

When i run the a query:
Select * from table where LastName='cccc'

Looking at the plan, i see that the clustered index is not being used. It appears as if the order of columns
in the where clause need to be identical to the order of columns of the clustered index.

Why Sql server needs the where clause to have the same order as in the index? I was hoping since LastName is
part of the index, Sqlserver would pick it up for the processing. 

Please guide.

thanks
MS

Viewing all articles
Browse latest Browse all 5123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>