This script was developed to manage a pair of databases that were basically the same, but very different in the schema/metadata content. Unfortunately - they both had the same database name, and were in 2 very specific areas (our main SQL Server and a bunch of hardware devices that were running a very watered down version of the database on Embedded Windows, which is basically WinXP and SQL Server 2005 Express). The environment as a whole is on SQL Server 2005 with SP3 (at the time of this offering, SP4 had not been tested for this project, and thus was not a part of any field/dev test).
So essentially - the script works as follows:
- Each section of the UPDATE script has 2 areas. 1 for one database and 1 for the other (specified with the values of 'c%' and 't%' in my example.
- Simply add in your DDL/DML updates in a specific VERSION section that you would like to have identified for that release.
- Whether or not a VERSION release area has content in it or not, your database is going to claim to have received that update. In my example you see 2 sections. This was done for demonstrating how easy it is to simply add another VERSION section, and the logic needed in each.
Please feel free to modify this as you like to make it work specifically for you, as well as better for best coding practices/logic.
I want to thank both Pam Brisjar and Geoff Russell for thier assistance in getting the logic for this put together, correctly.
* * * * *EDIT* * * * *
I unfortunately did not properly include the 2 tables and 1 DML trigger needed for this script to work. Please see the discussion section for those DDL pieces. Thanks, and my apologies.