Duplicating a TABLE using Microsoft SQL Server Management

前端 未结 4 1912
耶瑟儿~
耶瑟儿~ 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 07:54

    An easy way to copy a table and all of it's data:

    SELECT * INTO 
        [DATABASE_NAME].[SCHEMA_NAME].[NEW_TABLE_NAME] 
    FROM 
        [DATABASE_NAME].[SCHEMA_NAME].[OLD_TABLE_NAME]
    

    The SCHEMA_NAME is often dbo

提交回复
热议问题