MS SQL Script Execution Order
Posted: Mon Feb 26, 2007 8:06 pm
I'm having some very odd results scripting our MS SQL 2005 database installation into InstallAware.
In a prior version of our trial application we used InstallAware to successfully script the creation of our database and insert some data. Now with the latest version of our trial, we have 6 update scripts to run to bring the prior trials database up-to-speed. The script execution is sometimes successful but more often than not it fails. After testing this for nearly 8 hours in various configurations i've come to the conclusion that it seems like InstallAware is executing scripts out-of-order.
For example,
Looking at the InstallAware MSI Code I am executing this:
SQL Server Script: createdatabase (we know this works from prior version)
SQL Server Script: createtablesandstuff (we know this works from prior version)
SQL Server Script: updatedb1 (we know the script itsself works fine)
SQL Server Script: updatedb2 (we know the script itsself works fine)
SQL Server Script: updatedb3 (we know the script itsself works fine)
SQL Server Script: updatedb4 (we know the script itsself works fine)
SQL Server Script: updatedb5 (we know the script itsself works fine)
SQL Server Script: updatedb6 (we know the script itsself works fine)
Now each of these updatedb scripts has a version number that gets updated in our database, so updatedb1 updates the version to 1, updatedb2 updates the version to 2, and so on. The problem we're running in to is that after the installation is complete the version is not correct because it appears as-though InstallAware is not executing these scripts in order.
Sometimes our database ends up version 2, or 5, or 6, but it's not predictable. I can write an application that executes the scripts (and they work fine) but the reason we're using InstallAware in the first place is so the scripts are somewhat hidden (I don't want to have to include them in the directory we install the application and use them from there if I can avoid that).
Is InstallAware executing each script before the prior script has completely finished execution??
That's the only illogical conclusion i've been able to draw...
(Please note: before you mention putting all the scripts1 through 6 into one script I'll tell you that I can't.)
Thanks in Advance,
GS
In a prior version of our trial application we used InstallAware to successfully script the creation of our database and insert some data. Now with the latest version of our trial, we have 6 update scripts to run to bring the prior trials database up-to-speed. The script execution is sometimes successful but more often than not it fails. After testing this for nearly 8 hours in various configurations i've come to the conclusion that it seems like InstallAware is executing scripts out-of-order.
For example,
Looking at the InstallAware MSI Code I am executing this:
SQL Server Script: createdatabase (we know this works from prior version)
SQL Server Script: createtablesandstuff (we know this works from prior version)
SQL Server Script: updatedb1 (we know the script itsself works fine)
SQL Server Script: updatedb2 (we know the script itsself works fine)
SQL Server Script: updatedb3 (we know the script itsself works fine)
SQL Server Script: updatedb4 (we know the script itsself works fine)
SQL Server Script: updatedb5 (we know the script itsself works fine)
SQL Server Script: updatedb6 (we know the script itsself works fine)
Now each of these updatedb scripts has a version number that gets updated in our database, so updatedb1 updates the version to 1, updatedb2 updates the version to 2, and so on. The problem we're running in to is that after the installation is complete the version is not correct because it appears as-though InstallAware is not executing these scripts in order.
Sometimes our database ends up version 2, or 5, or 6, but it's not predictable. I can write an application that executes the scripts (and they work fine) but the reason we're using InstallAware in the first place is so the scripts are somewhat hidden (I don't want to have to include them in the directory we install the application and use them from there if I can avoid that).
Is InstallAware executing each script before the prior script has completely finished execution??
That's the only illogical conclusion i've been able to draw...
(Please note: before you mention putting all the scripts1 through 6 into one script I'll tell you that I can't.)
Thanks in Advance,
GS