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

BAsic MSI: Conditional execution of Sql Scripts

I am trying to use the Sql Scripts view to conditionally execute sql scripts
based on a property set to yes or no. this does not seem to work
either using the "run script during login" or "run script during install"
checkboxes.
My scripts seem to run as if no conditions were set up.
I would really like to use this way of doing things to take advantage of the string substitution facilities of this view.
What do I have to do to set up to run a sql script based on a value I retrieve from the registry during the UI sequence?
Labels (1)
0 Kudos
(2) Replies
DLee65
Level 13

I do not have extensive knowledge of this process but from the little that I have worked with this, you should be able to set the property in the sqlScript.sql Runtime tab.

For instance in a test that I setup I just added MYPROPERTY~="Yes". The tilde is the case insensitive operator. Now just make sure that the property table does not include a default value that could cause your script to fail.

Finally, run the setup with logging enabled and view the MSI log. Find the component name and see when that is being installed. Then see what the value of the property is prior to running the script. This should tell you definitively if the property is being honored.
0 Kudos
finfante
Level 3

Dan,
Thanks for the reply and the clue about using ~= operator.

It looks to me as if the conditional test in the sql script view when it looks like this: MCUPGRADEDB=1 succeeds
whereas if it looks like this: MCUPGRADEDB="1" it fails.

BUT in my installscript code I do

value = "1";
MsiSetProperty(hMSI, @MCUPGRADEDB, value);

make any sense?
0 Kudos