Duplicating a TABLE using Microsoft SQL Server Management

前端 未结 4 1909
耶瑟儿~
耶瑟儿~ 2021-02-02 07:35

Need to duplicate a TABLE using Microsoft SQL Management Studio 2008

The TABLE needs to duplicate all table row (Primary Key) ID as well.

4条回答
  •  失恋的感觉
    2021-02-02 08:11

    In SSMS open a new query window and then do something like

    SELECT * INTO NewTable
    FROM OldTable
    

    change NewTable to the name that the new table should have, change OldTable to the name of the current table

    this will copy over the basic table structure and all the data...it will NOT do any of the constraints, you need to script those out and change the names in those scripts

提交回复
热议问题