SQL Comparison SDK™
Walk-through: Using Red Gate APIs
This walk-through will show you:
- Using the SQL Compare API to automate comparison and synchronization tasks
- Features in the SQL Comparison SDK
- Building your application
Stop walk-through
Step 7: Generating a synchronization script
Once we have a differences collection, we need to instantiate a work object to generate a synchronization script.
We call w.BuildFromDifferences and pass in true as the last parameter, since we want to run the generated script on the second database:
Work w=new Work();
w.BuildFromDifferences(differences, Options.Default, true);
This work object now represents the work that needs to be done to synchronize the databases.
The work object exposes interesting properties. For example, the Messages collection contains a list of messages describing the work that needs to be done, and the Execution Block property represents the SQL that needs to be run, to synchronize the two databases.




