1

I want to combine two databases in SQL Server 2008 r2. Both databases will be identical in scheme. There will be some data that is identical in each and most likely some data differences.

I would say I am an intermediate user although far from being an expert. Any help getting me on the right track would be much appreciated.

2
  • The biggest hurdle will be how will you decide which data to keep and which to drop. Once you nail that down the rest will be easy. Commented Oct 12, 2012 at 21:56
  • Are you using natural keys or something like identity columns on the tables? Commented Oct 12, 2012 at 22:10

1 Answer 1

2

Well I do not know if you just want to merge once for some purpose or you will be needing to keep sync of changes in both databases, either way I'd recommend using a schema/data comparison tool for that. We use a product from RedGate called SQL Compare and it really save us a lot of trouble.

So whenever some developer make changes to their local copy of a database they can compare it to another that is "production-state" so we can generate scripts to sync both. It is pretty straightforward although it is easier if you have properly PK's on your tables (for data comparison that is) either way you can always set up which keys and combinations to use for data comparison. For schema comparison it's even easier.

Just an extra tip, these guys have also a product called SQL Source Control which is exactly that, source control for databases, could save a lot of time too.

Just a note: I do not intend to sell their products, but they are so damn good and had saved us so much time that I had to mention them :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.