Saturday 6 April 2013

What is index hint?


  I can ask this question another way

  suppose I have one table and 20 indexes are  on the table. But i want to force on query to use  index which i think it will give fast result .
  So is it possible ?

Ans - Yes. Through index hint it is possible.
     
   I think you got answer.Index hint means  forcing  query to use specified index not the index selected by query optimiser.

e,g

create table Movie(name varchar(100),id int identity(1,1))

create nonclustered index Movie_Name_I on Movie(name)

select * from name  with (index(Movie_Name_I ,nolock)) where name='xyz'

1 comment:

  1. Dear shrikant,
    I was getting this issue from long time.I have implemented payment module in my project.In my project I have error logger .I searched alot and modified code but not succeed.
    After reading your blog my issue is resolved.
    Thanks shrikant.kindly give me your email address.

    Regards ,
    Gajanan B

    ReplyDelete

First Database In Sql Server