Reviews

Review: SQL Comparison & Synchronization Toolkit

SQL Comparison & Synchronization Toolkit
$890
Red Gate Software
Cambridge, United Kingdom
+44 870 160 0037
www.red-gate.com

A year or so back I looked at some of Red Gate's SQL Server products. Specifically, they market SQL Compare, which can compare and synchronize SQL Server database objects, and SQL Data Compare, which can do the same for SQL Server data. Now they've taken the APIs from inside of those products and broken them out as a separate .NET-compatible toolkit.

With the toolkit installed, you get three new assemblies that you can reference in your .NET applications:

  • RedGate.SQL.Shared.dll
  • RedGate.SQLCompare.Engine.dll
  • RedGate.SQLDataCompare.Engine.dll

There's also a help file to explain how to use these goodies, as well as tutorials and sample code in C# and VB .NET. Synchronizing a pair of databases is one simple task you can perform:

Database Production=new Database();
Database Staging=new Database();

Production.Register(new ConnectionProperties(".", "Production"),
Options.Default);
Staging.Register(new ConnectionProperties(".", "Staging"),
Options.Default);

Differences differences=Production.CompareWith(
Staging, Options.Default);

foreach (Difference difference in differences) {
difference.Selected=true; }

Work work=new Work();
work.BuildFromDifferences(differences,
Options.Default, false);

ExecutionBlock block=work.ExecutionBlock;
RedGate.SQL.Shared.Utils utils=new
RedGate.SQL.Shared.Utils();
utils.ExecuteBlock(block, ".", "Production");

block.Dispose();
Production.Dispose();
Staging.Dispose();

You get the idea. In addition to comparing and synchronizing databases, you can get at informative messages or the SQL that the tool will generate and use to do the job. You can also explore and script individual database objects, save and load comparison projects, or save a snapshot of a database.

Sure, with enough work you could do most of what this toolkit does with a combination of executing SQL statements, spelunking with SQL-DMO, and perhaps automating DTS. But how much is your time worth? If synching up SQL Server databases is something you need to do, but not your core job, you might well be better off buying the already-tested code. Once you've bought it, you can distribute the libraries royalty-free with your application. There's a 14-day trial bundle (with the toolkit and the individual SQL Server utilities) available at the Red Gate Web site.

About the Author

Mike Gunderloy has been developing software for a quarter-century now, and writing about it for nearly as long. He walked away from a .NET development career in 2006 and has been a happy Rails user ever since. Mike blogs at A Fresh Cup.