Results 1 to 7 of 7

Thread: Index

  1. #1

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950

    Index

    Hey,

    Can I have a ix_Index in one table and another ix_Index in another table in SQL Server?

    I get an error that the indx already exists?

    Can't you have 2 indexes with the same name in different tables in SQL Server?

    Thanks,
    Don't anthropomorphize computers -- they hate it

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Indexes are not stored 'in' the table. They're stored together. So, no, you should have different names.

  3. #3

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950
    what's the proper naming conventions for indexes then?
    Don't anthropomorphize computers -- they hate it

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    mendhak_indexname.







    Actually, there's no as-such proper convention, but I've usually seen

    something_index or index_something

  5. #5
    Fanatic Member vb_dba's Avatar
    Join Date
    Jun 2001
    Location
    Somewhere aloft between the real world and insanity
    Posts
    1,016
    I tend to include the table name and column names in my Index names, sometimes paraphrasing the table/column names if there are very many:
    ix_tablename_columnname
    Chris

    Master Of My Domain
    Got A Question? Look Here First

  6. #6
    Hyperactive Member sw_is_great's Avatar
    Join Date
    Nov 2003
    Posts
    330
    You cannot have two objects with the same name.
    a table and an index cannot have the same name in a single db.
    Regards

  7. #7
    Hyperactive Member sw_is_great's Avatar
    Join Date
    Nov 2003
    Posts
    330

    Naming convention for indexes

    Naming convention for indexes

    Usually it is like
    TableName_nIX
    where n is a number

    if it is PK index then
    tablename_PK
    Regards

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