[Incident]: Some users report they are unable to access the case portal. Please see this community notice for more information.

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

Sql Script Conditional Statement during patch

Hello guys.

I developed a Web project with some SQL Scripts.
I made an upgrade and also a Patch named "PatchConfiguration1".
I want some sql scripts to be executed during the patch and not during the firs install or reinstall, only with the patch execution.

I set the "reevaluate condition" option at the component section and wrote Patch = "PatchConfiguration1" at the "specify a conditional statement" on the runtime (sql script).

nothing happend, the script is not executed durint Patch.

What's wrong with the conditional statement?

Thanks a lot for your cooperation.

Ariel M.
Labels (1)
0 Kudos
6 Replies
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

Are you setting a property named PatchConfiguration1 at runtime? If not, the condition would evaluate to false and prevent the script from running.

You can create a verbose log of the patch installation to verify whether or not a property named PatchConfiguration1 is set or not.
0 Kudos
ArielM
Level 3

Hello Josh
I didn't set a property at run time. The PatchConfiguration1 is the name of the patch I created.

I just want to make reference to the patch in the conditional statement in Sql Script RunTime tab so I could run the script ONLY when the patch is executed.

Thanks a lot for your cooperation.

Regards

Ariel
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

Windows Installer doesn't provide any particular property that is set only in a specific patch (at least not that I'm aware of). There is the PATCH property that is set when any patch is running.

You could try using a set property custom action sequenced early in the installation that sets a property unique to the patch that is running, conditioned on the PATCH property so that the custom property is only set when a patch is being installed (the value of the property or the property name could be changed with each patch).
0 Kudos
ArielM
Level 3

Josh can I do a reference in the conditional statement to "PATCH" so the script execute when the patch is also executed?
or should I put "is PACTH"?

Thanks a lot Josh

Regards

Ariel M.
0 Kudos
TheTraveler
Level 8

If the project uses Install Shield Script, you may want to try an alternative. I often use ADO objects to Create and Upgrade the database in our product. Here are a couple of links that might interest you.

Link #1
Link #2

Since you create the ADO objects yourself, you have a lot of control on where you start in the file. I have written ours to run a SQL batch script file to traverse it one SQL Statement at a time and execute it. This allows me to show a progress bar and if it errors, I know exactly what SQL statement errors and I get the SQL Server error message. I can then log it and ask the user if they want to continue or not. I have also built into my source code a tag that I can put into the SQL file that will stop in the middle of the file in case I need to run a data migration tool and continue where I left off. I have also built into the SQL file a database versioning system. So if I'm upgrading a database, I can find the starting point in the file and start executing the SQL scripts from that starting point.

So I hope I have sparked your imagination to the possibilities.
0 Kudos
vinays
Level 2

did u get the solution? if yes, can u share the condition.

0 Kudos