Results 1 to 7 of 7

Thread: Using Index in Open Select statement

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    Using Index in Open Select statement

    I have an SQL 2000 table that has a non clustered Index built. When using Select statements in VB to open this table, do I need to reference the Index that is built or is the Index automatically used? If not, what is the correct syntax for using the Index in my open statement?

    Thanks
    David Wilhelm

  2. #2
    WALDO
    Guest
    I do believe the nidex is automagically used.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    Multiple indexes

    What if there are multiple indexs built? Does it automatically use the most efficient one?
    David Wilhelm

  4. #4
    WALDO
    Guest
    I believe so. If anyone would care to rebut, be my guest.

  5. #5
    Fanatic Member RSINGH's Avatar
    Join Date
    May 2001
    Location
    London
    Posts
    522
    The wrong index can be used. In the case of multiple indexes, you can specify the one that you want to use as thus.

    SELECT blah
    FROM blah (INDEX = indexname)

    or something like that.
    The liver is bad. It must be punished.

  6. #6
    Fanatic Member
    Join Date
    Feb 2002
    Location
    SE England
    Posts
    732
    I would rely on SQL server getting it right 99.10102099919% of the time tho...
    Leather Face is comin...


    MCSD

  7. #7
    Fanatic Member RSINGH's Avatar
    Join Date
    May 2001
    Location
    London
    Posts
    522
    True, but in my experience on VLDB's with several indexes on a table, the wrong one has been used. This is more likely on views with many tables and JOINS. Otherwise you're right.

    nb - you're 0.004352001 out
    The liver is bad. It must be punished.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width