SQL Comparison SDK
The current version of the Red Gate SQL Comparison SDK is 10.0. This contains the code for SQL Compare (schema) 10.0 and SQL Data Compare (data) 10.0.
Important: The Database constructor may throw an Argument Null exception in 10.0 - please use this patch.
API reference information, examples, and instructions on how to distribute your applications are provided on the Web site SQL Comparison SDK support pages
SDK versions 8 and higher ship with a full installer to create Visual Studio projects and sample databases. For previous versions, an unofficial installer is available for SDK version 7.1.
More information can be found on the SQL Comparison SDK product page
Please post questions or initiate discussions on the Support Forum
Contents |
Code Samples
The examples in this collection highlight some of the more popular uses for the SQL Comparison SDK, including comparing schema and data to backups, copying tables from one database to another, and viewing differences in schema and data. They were produced independently of the SDK developers based on customer suggestions.
(The following examples are syntax highlighted using our code highlighting tool)
SQL Compare
| Sample | API version | Language |
|---|---|---|
| Create a list of dependencies | 8 | C# VB |
| Post-process the migration script | 7&8 | C# VB |
| Schema Object Restore from Backup | 8 | C# VB |
| Compare live schema to backup | 8 | C# VB |
| Comparing, scripting Schema | 7&8 | C# VB |
| Compare live schema to backup | 7 | C# VB |
| Loading Projects, Script Folders and Snapshots | 7&8 | C# VB |
| Schema Object Restore from Backup | 7 | C# VB |
| Output Report of Schema Differences | 7&8 | C# VB |
| Selecting Objects to Synchronize | 7&8 | C# VB |
| Synchronizing Schema - Live Database, Scripts folder | 7&8 | C# VB |
| Synchronizing schema to a scripts folder | 8.2 | C# VB |
| Examining script parser errors | 8 | C# VB |
| Compare Azure databases | 10.0 | C# VB |
| Map Owners | 10.0 | C# VB |
| Table rename | 10.0 | C# VB |
| Script all objects | 10 | C# VB |
SQL Data Compare
| Sample | API Version | Language |
|---|---|---|
| Blob Example | 7 | C# VB |
| Comparing a live database to a backup | 7 | C# VB |
| Comparing a live database to a backup | 10 | C# VB |
| ComparisonSession Example with column filter | 7 | C# VB |
| Filtering rows using delegates | 7 | C# VB |
| Create, load, run project | 7 | C# VB |
| Create, load, run project | 8 | C# VB |
| Create database scripts | 7 | C# VB |
| Registering a database from backup | 7 | C# VB |
| Excluding all columns with specified name | 7 | C# VB |
| Display, sort, filter comparison results | 7 | C# VB |
| Mapping different tables, columns | 7 | C# VB |
| Filter data using WHERE clauses | 7 | C# VB |
| Synchronizing data to a scripts folder | 8 | C# VB |
SQL Compare & SQL Data Compare Examples
- SQL Compare & Data Compare used to restore schema and data
- Running synchronization code using ADO .NET
Sample API projects
The SQL Comparison SDK provides sample projects in Visual Basic .NET and C#. To download the sample projects, click on the title:
- Object-level restore using SQL Backup - a complete downloadable UI project using the SQL Comparison SDK
- Generate deployment executable or installer class from scripts - complete UI project
Knowledge Base articles
Forum Links
Blogs
- Updating a customer database schema example
- Using SQL Comparison SDK as part of a continuous integration process
- Using the SDK in an NAnt task
- Using the SDK in an MSBuild task
- Using the filtering API in SQL Compare Engine (v8.x)