Copying A Table

From DataSelf Knowledge Base
Jump to navigation Jump to search

Copy a Table and all it's Data to another table

(Can create a copy of a table in the same database)

  1. Open SSMS
  2. Right-click database name
  3. Tasks > Export Data
  4. (Choose a Data Source window)
    Make note of the Server name.
  5. Next
  6. (Choose a Destination window)
    Server name = enter same as in Data Source window
  7. Database = select from drop down list
  8. Next
  9. (Specify Table Copy or Query)
    Click "Copy data from one or more tables or views"
  10. Next
  11. (Select Source Tables and Views)
    Mark the checkbox for the source table
  12. Edit the table name in the Destination column
  13. Use Edit Mappings to change or drop columns
  14. Verify results with Preview
  15. Next
  16. (Save and Run Package window)
    Mark "Run immediately"
  17. Next
  18. Finish

Copy Only the Structure of a Table (No data)

Using SQL Server Management Studio To duplicate a table's structure

(Does not copy the data)

  1. Connect to the table's database in SSMS.
  2. In Object Explorer, right-click Tables and click New Table.
  3. In Object Explorer right-click the table you want to copy and click Design.
  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.


Where to click to select columns.