Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

Did you know that "5/2" has a different meaning in some parts of the world? – ypercubeᵀᴹ May 13 '13 at 15:37
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.

share|improve this answer
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
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.