in

wahooga.com

A report on life in Technical Support for a software company

Dave Mellors

SQL Comparison SDK - Updating a customer database schema example

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

Share this post: email it! | bookmark it! | digg it! | reddit!

Comments

 

Toan Nguyen said:

Dave,

One quick and stupid question: I'm trying to build your SqlDBDeploy project in MS C# 2008 Express and I got 3 errors: namespace name 'StatusEventArgs' could not be found. It's being used in these places:

private delegate void ThreadSafeStatusCallback(object sender, StatusEventArgs e);

private void WorkStatusCallBack(object sender, StatusEventArgs e)

private void StatusCallback(object sender, StatusEventArgs e)

My question is am I missing a unit somewhere or should I add a reference to the project or should I create a generic StatusEventArgs to bypass this error?

Thank you.

September 4, 2008 7:50 PM
 

Dave Mellors said:

The StatusEventArgs should be part of the RedGate.SQL.Shared assembly and as long as you reference that in your project you should be OK.

If you do have it reference already then I guess it might be that you are using an older version of the assembly and therefore it doesn't exist.

Let me know if you still have problems. Thanks, Dave

September 4, 2008 8:28 PM
 

Toan Nguyen said:

Dave,

Is it possible to communicate via email? I promise I will keep your email address top secret. I got all kind of problems using your sample project and the latest SQL Compare SDK 7 I just downloaded. I think they're not in sync because yours refer to SDK 6. The assemblies and in different folder and the functions are declared and used differently now.

Thank you.

September 5, 2008 12:56 AM
 

Dave Mellors said:

No problem. I did email you my reply as well as posting it on the blog but I guess you didn't receive it. My email is dave@wahooga.com and meanwhile I will also try the example with the latest version.

September 5, 2008 4:40 PM

Leave a Comment

(required)  
(optional)
(required)  
Add

About Dave Mellors

I work for Red Gate Software in Cambridge, UK as part of the technical services team. This is my personal blog and so carries my own personal views which could vary from the views and opinions of my employer. I am passionate about IT and would like to change the way that people think about the IT industry and the people that work in it. Particularly those who work in the support teams.
Copyright 2007 Dave Mellors
Powered by Community Server (Non-Commercial Edition), by Telligent Systems