Share via


How to: Duplicate Tables

A table can appear only once in a database. However, if you want to create a new table that contains some or all of the columns in an existing table, you can create a new table and then copy column information from an existing table.

Note

A new version of Table Designer appears for databases in the SQL Server 2012 format. This topic describes the old version of Table Designer, which you use with databases in earlier formats of SQL Server.

In the new version, you can change a table definition through a graphical interface or directly in a script pane. If you use the graphical interface, the table’s definition is automatically updated in the script pane. To apply the SQL code in the script pane, choose the Update button. For more information about the new version, see How to: Create Database Objects Using Table Designer.

Note

This operation duplicates only a table's structure; it does not duplicate any table rows.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To duplicate a table

  1. Make sure you are connected to the database in which you want to create the table and that the database is selected in Server Explorer.

    For more information on connecting to a database see How to: Connect to a Database from Server Explorer.

  2. From the Data menu, point to Add New and then click Table.

  3. In Server Explorer right-click the table you want to copy and click Open Table Definition from the shortcut menu.

    The table opens in a second Table Designer window.

  4. Select the columns in the existing table and, from the Edit menu, click Copy.

  5. Switch back to the new table and select the first row.

  6. From the Edit menu, click Paste.

  7. From the File menu, click Save table name.

  8. In the Choose Name dialog box, type a name for the new table and click OK.

See Also

Tasks

How to: Copy Columns from One Table to Another

Other Resources

Working with Tables in Table Designer