Merging data in database in SQL Server 2012

Home Forums Other Microsoft Servers and SaaS SQL Server 2005 / 2008 / 2008 R2 / 2012 / 2016 Merging data in database in SQL Server 2012

This topic contains 2 replies, has 3 voices, and was last updated by Avatar George Coll 3 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • Avatar
    salim71
    Member
    #166521

    Hello,

    I am using SQL Server 2012. I have 2 databases, DB1 and DB2. DB1 contains data for the month of January, February and March. DB2 contains data between February to June. I would like to move the data from DB1 to DB2 so that DB2 contains data from January to June. I have used SQL Server Import and Export Data Wizard and it wizard completed successfully. However I ran into an issue. When I query DB2, I can see duplicates records. Does anyone know how I can merge data without duplicates? Any help is greatly appreciated.

    Thanks

    Salim

    Avatar
    Ossian
    Moderator
    #191325

    I would not even bother moving the data, just create a union query which retrieves from db1 and db2

    As far as the duplicate records go, are you sure there wasn’t something already in DB2 before the import, or did you run the import more than once?

    Avatar
    George Coll
    Member
    #374585

    Thank you so much for replying. I will try the UINON query. There was already data in DB2 before the import.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.