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

后端 未结 6 2245
北海茫月
北海茫月 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:36

    By default the right-click table "CREATE" does not include the indexes or triggers, just the table definition and constraints.

    You can right click the database and click "Tasks" -> "Generate Scripts" which will allow you to do this

    Edit: this is the default but as TFD mentions it can be changed, thankfully.

提交回复
热议问题