Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2003
    Posts
    212

    Unanswered: Adding indexes to tables

    I have a database on Server A and i copy the database over to Server B. But since the data on the database is transformed (I add new columsn to eacht able in the db) during the transfer, I simply transfer the data and nothing else.

    Once the transfer is complete I want to add all the indexes on each table in the original db. How would i do that?

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Why don't you transfer the entire tables, with indexes, and then add your columns?

    blindman

  3. #3
    Join Date
    Sep 2003
    Posts
    212
    Originally posted by blindman
    Why don't you transfer the entire tables, with indexes, and then add your columns?

    blindman
    Because the indexes i want to add must include the columns i'm adding.

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322

    Re: Adding indexes to tables

    Originally posted by vmlal
    Once the transfer is complete I want to add all the indexes on each table in the original db. How would i do that?
    Well then your statement isn't true..they're new indexes and yo need to build them...create a sql script modify them and run....

    don't know of an automated way...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    How can the indexes from the tables in the original DB include the columns you are adding? That makes no sense.

    You are going to need to write a script that adds whatever indexes you want, and then run the script after you modify your unindexed tables.

    blindman

  6. #6
    Join Date
    Sep 2003
    Posts
    212
    Yeah i have to add new indexes incl the new columns but all the other indexes excl. the new columns need to be added. i have a scripts to add the new indexes.

    Sum of the existing indexes have to be dropped before the new indexes can be added. But is there a way to aleast get the old indexes back?

  7. #7
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    If you can come up with a logical way to tell SQL Server what indexes you want to keep and what indexes you don't, then you MAY be able to do this programmatically. Otherwise, SQL Server doesn't have a clue what you want to do.

    Write a script. It is the best way to handle this.

    blindman

Posting Permissions

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