This question already has an answer here:

I have a SQL-Server database that crashed while I was away on vacation. All info from 5/2/13 is missing from our current database because my replacement implemented a back-up of the database from 5/1/13. So, My current database has all information up to 5/1/13 (missing data from 5/2/13) and 5/3/13 on. I have access to, the database with all info from 5/2/13 Is there a way to merge this info?

marked as duplicate by Jon Seigel, StanleyJohns, Aaron Bertrand, dezso, Max Vernon May 14 '13 at 21:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    Did you know that "5/2" has a different meaning in some parts of the world? – ypercubeᵀᴹ May 13 '13 at 15:37
  • 2
    Which RDBMS, for starters? – Philᵀᴹ May 13 '13 at 16:06
  • Do you possibly mean "merge the transactions" rather than "merge the databases"? If so, whatever solution is put forward will be subject to the possiblity that some transactions that were allowed in the actual scenario would have been disallowed if the the 5/2 transactions had been applied before the 5/3 transactions were attempted. – Walter Mitty May 14 '13 at 10:09

You'll have to manually query for the rows and copy then in using either T-SQL or SSIS. There's no way to take the two databases and have SQL Server just merge them into one database.

If you are using identity vales on tables you'll need to be careful of duplicate values and assign new values to the rows that you are inserting. If you have other tables which rely on those values those tables will need to be updated with the new values as they are written to the production database.

This isn't an easy thing to do, but it is doable.

  • 1
    Assuming SQL Server? – Philᵀᴹ May 13 '13 at 16:07
  • Yep, I'm assuming SQL Server as it's tagged SQL Server and says SQL Server in the question. – mrdenny May 13 '13 at 17:11
  • 1
    Before it got edited.... Sigh. – Philᵀᴹ May 13 '13 at 17:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.