Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find the differences between two databases? [closed]

I am trying to copy changes from DatabaseA to DatabaseB, however I don't know exactly what those changes were.

Is there a SQL script around that will find objects that are different between the databases, then generate a script to update DatabaseB to match DatabaseA?

I'm using SQL 2005, and I don't want to lose the existing data in DatabaseB

like image 456
Rachel Avatar asked Jan 24 '12 13:01

Rachel


3 Answers

Try DBComparer.

like image 184
Gustavo F Avatar answered Oct 13 '22 13:10

Gustavo F


There are schema and data compare tools from Red Gate that do exactly what you're looking for. There are also some others in the market, like Apex SQL Compare. But, if you're fortunate enough to have Visual Studio 2010 Premium or Ultimate edition, there is a compare tool built in to those versions.

http://www.apexsql.com/default.aspx

http://www.red-gate.com/products/sql-development/sql-compare

http://msdn.microsoft.com/en-us/library/dd193250.aspx

Otherwise, you're going to have to use linked servers and a lot of querying against the INFORMATION_SCHEMA.

Some of those software tools you can use on a trial basis and probably get what you need without buying a full license.

like image 28
Vinnie Avatar answered Oct 13 '22 12:10

Vinnie


I have used "SQL Compare" and "SQL Data Compare" by Red Gate Software, and they work like a charm. I do not suppose that there exists a script to do the same job, because if it existed, then there would be no use and no market for these products.

like image 37
Mike Nakis Avatar answered Oct 13 '22 12:10

Mike Nakis