If there is a SQL command that forces a SQL SELECT statement to use a specific index, what it is?
Take a look in BOL for hints. Sometimes it's appropriate, but think twice before doing it - what will work in one case may not work as well in another. Your code also becomes dependent on that particular index to work. If you (or another DBA) in the future decides to drop the index, your code will break.
The exact syntax is:
FROMtable_name WITH (INDEX = index_name)
ORDER BY field_names
I concur with Andy. You probably want to avoid this. You are assuming you know more than the program for a particular statement, which may not be true for different load levels. Also, this creates a point of maintenance. If you create a new index or remove this one (for some reason), will you remember to update this query?
Follow me on Twitter: http://www.twitter.com/way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Viewing 6 posts - 1 through 5 (of 5 total)