This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: SQL Scripts to run only on first time install
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 25, 2008
10:28 AM
SQL Scripts to run only on first time install
I have an InstallScript MSI project with some SQL scripts under the Server Configuration->Sql Scripts view.
Some of these scripts should only be called on the first install. I checked on these scripts the "Run Script During Install", but it gets also called on repair or update.
Is there any way to make them execute only on first install?
I tried to set a property OnFirstUIBefore:
MsiSetProperty(ISMSI_HANDLE, "MYPROJECT_FIRST_INSTALL", "first");
and use it under "Specify a Conditional Statement", but this statement does not seem to be evalutated properly.
Any idea?
Some of these scripts should only be called on the first install. I checked on these scripts the "Run Script During Install", but it gets also called on repair or update.
Is there any way to make them execute only on first install?
I tried to set a property OnFirstUIBefore:
MsiSetProperty(ISMSI_HANDLE, "MYPROJECT_FIRST_INSTALL", "first");
and use it under "Specify a Conditional Statement", but this statement does not seem to be evalutated properly.
Any idea?
(10) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 25, 2008
12:38 PM
the NOT INSTALLED = "TRUE" condition should work.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 28, 2008
03:12 AM
Seems not to work. Whatever the condition evaluates to in the first install, it seems to keep that value on the maintenance installs.
I have the feeling, the conditions to run the SQL Scripts are not reevaluated during a maintenance/update install.
Is it possible to have the feature conditions reevaluated on maintenance?
I have the feeling, the conditions to run the SQL Scripts are not reevaluated during a maintenance/update install.
Is it possible to have the feature conditions reevaluated on maintenance?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 28, 2008
08:08 AM
I tried several other methods, none seem to work.
I have an SQL script createDB.sql belonging to a feature "localDatabase". This script create the whole db schema with tables, users, stored procedures,.... I would like my InstallScript MSI project to call it only on the first install.
I inserted the script under Server Configuration/SQL Scripts. Under runtime, i tried several settings:
[LIST=1]
Checked "Run Script During Install" only -> script is called always, on first install, repair, change
Checked "Specify a Conditional Statement" only and set as condition: NOT INSTALLED -> script is never called
Checked "Specify a Conditional Statement" only and set as condition: (&localDatabase=3) AND NOT (!localDatabase=3) -> script is never called
Any other idea?
I have an SQL script createDB.sql belonging to a feature "localDatabase". This script create the whole db schema with tables, users, stored procedures,.... I would like my InstallScript MSI project to call it only on the first install.
I inserted the script under Server Configuration/SQL Scripts. Under runtime, i tried several settings:
[LIST=1]
Any other idea?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 28, 2008
01:28 PM
Please try "NOT Installed" instead of "NOT INSTALLED". You may also need to set the Reevaluate Condition property to Yes for the associated component of your SQL script. See this thread for more information.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 29, 2008
01:13 AM
I must do something wrong, I have tried "NOT Installed" but without success, the sql script is never called.
I have a feature "localDB":
- Install Level 500
- Condition to set installlevel to 1.
- the feature has two components: createDb.sql and dropDb.sql
Component createDb.sql_SQLComponent:
- Reevaluate Condition: YES
Component dropDb.sql_SQLComponent:
- Reevaluate Condition: YES
Server Configuration/SQL Scripts/createDb.sql:
- Runtime: checked only "Specify a Conditional Statement" and NOT Installed as condition
Server Configuration/SQL Scripts/dropDb.sql:
- Runtime: checked only "Run Script During Uninstall"
Why is createDb.sql not called on a first install? Did I miss something?
I have a feature "localDB":
- Install Level 500
- Condition to set installlevel to 1.
- the feature has two components: createDb.sql and dropDb.sql
Component createDb.sql_SQLComponent:
- Reevaluate Condition: YES
Component dropDb.sql_SQLComponent:
- Reevaluate Condition: YES
Server Configuration/SQL Scripts/createDb.sql:
- Runtime: checked only "Specify a Conditional Statement" and NOT Installed as condition
Server Configuration/SQL Scripts/dropDb.sql:
- Runtime: checked only "Run Script During Uninstall"
Why is createDb.sql not called on a first install? Did I miss something?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 29, 2008
12:15 PM
You probably need to set the Install Level property of the feature below 100, and then elevate it above 100 using the Condition property if you do not want to install the feature for some conditions. I recommend that you check to see if the feature "localDB" is getting installed by generating a Windows Installer verbose log for the installation.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 03, 2008
01:16 AM
hidenori wrote:
I recommend that you check to see if the feature "localDB" is getting installed by generating a Windows Installer verbose log for the installation.
Could you explain a bit more, or point me to page explaining this?
How do I check if the feature is installed by generation a windows installer verbose log?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 03, 2008
11:44 AM
You can generate a Windows Installer verbose log for your installation from the command line as follows:
setup.exe /v"/l*v c:\log.txt"
And search for the following entry in the log file:
Feature: localDB; Installed: Absent; Request: Local; Action: Local
Make sure that the Action state is Local.
setup.exe /v"/l*v c:\log.txt"
And search for the following entry in the log file:
Feature: localDB; Installed: Absent; Request: Local; Action: Local
Make sure that the Action state is Local.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 28, 2008
01:21 AM
I am facing similar problem. tom36, can you please confirm if the solution suggested by hidenori helped to resolve your problem. For me it didn't.
Any other solutions?:mad:
Any other solutions?:mad:
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 28, 2008
03:38 PM
The property is Installed not INSTALLED.
Not Installed
BTW, I find it better to just do inline logic/error handling in your SQL and let the script run whenever the associated feature is being installed/reinstalled/uninstalled. This gives you more flexibility in servicing.
Not Installed
BTW, I find it better to just do inline logic/error handling in your SQL and let the script run whenever the associated feature is being installed/reinstalled/uninstalled. This gives you more flexibility in servicing.
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)