[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 361
  • Last Modified:

SQL Sever copy table

Hello Gurus

I would like to copy the contents of  1 table (customers) from DB1 to another table called also Customers in BD2.

Since I am not sure about the indexes and structures... I would like to export the content to a csv file or excel or whatever format... and then go to the DB2 and delete the contents of the Customers table and insert the exported data...

SQL 2008

1 Solution
Rajkumar GsSoftware EngineerCommented:
As far as I understand your question, these are the ways that I came to mind now

Option 1 - You can use query to copy contents between databases in a single server.

INSERT INTO DB1.dbo.Customers SELECT * FROM DB2.dbo.Customers
Before doing this truncate or delete the data from destination table if required.
TRUNCATE TABLE DB2.dbo.Customers
DELETE FROM DB2.dbo.Customers

Option 2 - You can use import wizard to directly copy data to other database table or to an excel sheet.

I think You Can Use import - Export Wizard which is very easy to use

Please right click on your one of database
and than select task - > Import or Export Data
than Please Select Proper Source and Destination Databases and Tables
than Finish

If you find any error than just check that error
and go to Edit Mappings and Select ignore in case of Identity Column

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now