How to copy indexes from one table to another in SQL Server

后端 未结 6 2240
北海茫月
北海茫月 2020-12-15 05:38

I need to copy the indexes from one table to another. There are a LOT of indexes and I don\'t want to recreate them from scratch. Seems error prone anyways.

I have c

6条回答
  •  遥遥无期
    2020-12-15 06:19

    You could build a script using the information in sysindexes (or sys.indexes depending on your version) to recreate all of the indexes, but using the Select * into approach is also not going to pick up up foreign and primary keys or any extended proprties. You should really look into using SSIS if you are using a 2005+ version, or DTS if you are using 2000, both have wizards to simplify this kind of copy.

    SSIS Import Export

    DTS Import Export

提交回复
热议问题