cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
DFranke
Level 3

SQL Schema Version

I am trying to utilitize the SQL Schema Version to conditionally run my SQL Scripts. I need to be able to run the setup multiple times on a server and therefore I am not storing anything in the registry or adding entries to the Add/Remove Programs list.

I have one SQL Connection in the project. I have left the Catalog Name and server names blank and I am handling everything from within the SQL Scripts themselves.

I have 7 different scripts in the project that correspond with 7 different databases. The database names are set using properties from a Custom Dialog screen. The scripts determine whether or not the database exists and if it does it deletes it and then recreates.

When I run the setup program the first time it creates the 7 databases and inserts the Installshield table into each with correct Schema version in the table.

From what I read I thought I would be able to run the setup program again and since the schema version in the table matches the version for the script it would not run the script again. What I am seeing is that it is running all scripts again regardless (Destroying and re-creating the databases).

Am I missing something? How do I get this to work?
Labels (1)
0 Kudos
1 Reply
hidenori
Level 17

InstallShield cannot handle the Schema Version property correctly if you change the target database in your SQL scripts. We retrieve the current schema version from the connected database as soon as the connection is established, and write the new schema version to the connected database before the connection is closed.

In your case, the current schema version is retrieved from the default database which is normally 'master' as you leave the Database Name field blank. However, the new schema version is written to the different database that you switch in your scripts.

So I would suggest to you to take the custom error handling approach in order to accomplish your requirements. See this thread for more information.

Hope that helps.
0 Kudos