Duplicate a table including indexes

后端 未结 2 1207
北海茫月
北海茫月 2021-01-21 12:09

Is there a way to duplicate a table in SQL-Server? Not just the data like SELECT INTO does but also indexes and maybe keys as well? If I go script table as -> c

2条回答
  •  鱼传尺愫
    2021-01-21 12:55

    First go to Tools-> Options. Then go to SQL Server Object Explorer, Scripting. From here you will see all of the scripting options, including creating indexes. Creating indexes is turned off by default for some reason but you can turn it on easily enough.

    enter image description here

    After this then you can right click on the Script Table - Create to ...

    enter image description here

    And you should now get your indexes.

提交回复
热议问题