| title | Duplicate Tables | Microsoft Docs | ||||
|---|---|---|---|---|---|
| ms.custom | |||||
| ms.date | 03/14/2017 | ||||
| ms.prod | sql | ||||
| ms.prod_service | table-view-index, sql-database, sql-data-warehouse, pdw | ||||
| ms.reviewer | |||||
| ms.technology | table-view-index | ||||
| ms.topic | conceptual | ||||
| helpviewer_keywords |
|
||||
| ms.assetid | c6b07423-d1e5-4e5e-8681-5088921f5df3 | ||||
| author | stevestein | ||||
| ms.author | sstein | ||||
| monikerRange | >=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current |
[!INCLUDEtsql-appliesto-ss2016-all-md]
You can duplicate an existing table in [!INCLUDEssCurrent] by using [!INCLUDEssManStudioFull] or [!INCLUDEtsql] by creating a new table and then copying column information from an existing table.
Important
This operation duplicates only the structure of a table; it does not duplicate any table rows.
In This Topic
-
Before you begin:
-
To duplicate a table, using:
Requires CREATE TABLE permission in the destination database.
-
Make sure you are connected to the database in which you want to create the table and that the database is selected in Object Explorer.
-
In Object Explorer, right-click Tables and click New Table.
-
In Object Explorer right-click the table you want to copy and click Design.
-
Select the columns in the existing table and, from the Edit menu, click Copy.
-
Switch back to the new table and select the first row.
-
From the Edit menu, click Paste.
-
From the File menu, click Savetable name.
-
In the Choose Name dialog box, type a name for the new table and click OK.
-
Make sure you are connected to the database in which you want to create the table and that the database is selected in Object Explorer.
-
Right-click the table you wish to duplicate, point to Script Table as, then point to CREATE to, and then select New Query Editor Window.
-
Change the name of the table.
-
Remove any columns that are not needed in the new table.
-
Click Execute.