Overview
A common use of the Red Gate SQL Comparison SDK is to package up the latest version of a database schema and send it to customers as an executable. NOTE: SQL Comparison SDK is to be the new name for SQL Toolkit
Pre-requisites
Building the example
When you load the solution in Visual Studio you will need to update the references to the toolkit assemblies.
You can find the .dll files in the folder where you installed SQL Compare. The default location is Program Files\Red Gate\SQL Compare 6
If you want to change the splash image then you can replace the splash.jpg file in resources.
The embedded snapshot.snp file is used by default. A snapshot of the WidgetStaging database is included in the resources folder. You can delete it or replace it with your own snapshot but you need to remember to set the build action to Embedded Resource.
Using the example
The compiled example takes a number of command line parameters which are:-
/S:<servername>
- This is the server on which the database resides to synchronize.
/D:<database>
- The database name to update.
/B:<filename>
- If you want to make a backup of the original schema before an update specify a filename here.
/V:true
- Specify this if you want verbose information.
/UE:<snapshotname>
- Name of embedded snapshot to use. If /UB not specified then default is snapshot.snp /UB:<snapshotfilename>
- Name of snapshot file to use.
At the moment the example includes a snapshot for the WidgetProduction database so if you run the following parameters:-
SqlDbDeploy.exe /S:davidm\sql2005 /D:widgetproduction /B:backup.snp
This would update the widgetproduction database on davidm\sql2005, create a backup snapshot before doing an updates and call the file backup.snp and provide verbose output.
If you want to reset the database back to the original you would use:-
SqlDbDeploy.exe /S:davidm\sql2005 /D:widgetproduction /V:true /UB:backup.snp
SqlDbDeploy - The movie
Just in case you haven't installed the SDK yet you can view a flash movie of a demonstration of SqlDbDeploy.
Thank You
I would like to thank the Red Gate customers who provided information and source code which helped me to understand how they are using the SDK. In particular a big thank you to Rawden Hoff of Nebula Systems whose VB.Net example inspired me to produce this example.
Feedback & disclaimer
This example is provided "as is" and is not supported by Red Gate Software. This is my first .net Windows application so if you find this example useful or have any suggestions for improving it then it would be great to hear from you