Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How to enforce the Index

Author  Topic 

sponguru_dba
Yak Posting Veteran

93 Posts

Posted - 2007-01-03 : 09:45:59
Hi all


How to enforce the index to Select Statement
syntax i went through BOL i never find(i may missied) can some help
syntax for

select a,b,c,d,e,f from x,y,z

I h've index's on x only those ate indx1,indx2,indx3 now i want use indx2


Thank in Advance
SreenivasaRao


SreenivasaRao
Bangalore,INDIA

Kristen
Test

22859 Posts

Posted - 2007-01-03 : 10:08:31
SQL Server will use the index that it considers most efficient for a particular query. It is very rare to need to override this, and thus doing so generally is not Best Practice (because if you think you need to do it the likelihood is that you have missed something else!)

However, there are exceptions. Personally I can only think of one instance where I have forced a query to use a specific index - and I write a lot of queries in a year, and I've been doing it for a lot of years! Even allowing for my poor aged memory, its still a very rare event IME.

select a,b,c,d,e,f
from x,y,z WITH (INDEX(indx2))

Might be an idea if you post the query here and then folk can give you advice.

Kristen
Go to Top of Page

sponguru_dba
Yak Posting Veteran

93 Posts

Posted - 2007-01-03 : 10:40:03
Hi
Thanks Kristen,thanks for Advice

SreenivasaRao
Bangalore,INDIA
Go to Top of Page
   

- Advertisement -