Posts: 1
Joined: Fri Jun 11, 2021 12:57 pm

Run SQL Script only when upgrading

Fri Jun 11, 2021 1:04 pm


I in a bit of a problem. After reading the resources available here, I cannot determine why some SQL script are not running when upgrading older products.

I have 2 SQL scripts that I need to run when the process is an upgrade process. One of them creates a databases and its tables and another runs a stored procedure.

My setup looks like in the image bellow:


What should I do to have those 2 yellow marked script to run when upgrading?

Tks a lot!

Posts: 4400
Joined: Wed Jun 13, 2018 7:49 am

Re: Run SQL Script only when upgrading

Fri Jun 11, 2021 4:48 pm

Hello Catalin and welcome to our forums,

From what I can see in your screenshot, you have conditioned the SQL script with the UPGRADINGPRODUCTCODE property.

There are two properties that are set during an upgrade, namely:



As you may already know, the upgrade process consist of two steps:

- the uninstall of the older version

- the install of the newer version

The difference between these two properties consist of where they are set, i.e.:

- UPGRADINGPRODUCTCODE will be set in the uninstalled package

- OLDPRODUCTS property will be set only in a package that upgrades another package (i.e. the newer version)

Assuming you want to execute the SQL script when your new version is installed, please condition it with the OLDPRODUCTS property instead.

Hope this helps!

Best regards,
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”