cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
UNeverNo
Level 6

SQL behaviour during upgrade and uninstall

My MSI-Package rolls out a new database on install. So far, so good.

How do I uninstall it now depending on the database name the user entered? At the moment I use hard coded
DROP DATABASE 
but even this doesn't work...

And how to realize a minor upgrade? The upgrade package should as far as I know offer the possibility to install or upgrade the product. But in these cases I need two different SQLs and I don't find any switch for execution on upgrade...
Labels (1)
0 Kudos
(4) Replies
hidenori
Level 17

You need to have the following text replacement entry for your SQL script file:

Find What:
Replace With: [DBNAMETODELETE]

DBNAMETODELETE is a Windows Installer property where stores a database name your end user provides.

Also, in order to determine an install or upgrade, you may want to check if the Installed and REINSTALL properties are set.

Hope that helps.
0 Kudos
UNeverNo
Level 6

Hi hidenori,

thx for your reply, but it doesn't seem to help.

AT SQL Scripts, I added a new connection and underneath it two scripts. First one runs during installation and creates my database structure. Second one runs only during deinstallation:
DROP DATABSE [DBNAMETODELETE]

Unfortunately the database is still there after removing my software.

edit: I tried IS_SQLSERVER_DATABASE instead of DBNAMETODELETE but I still doesn't work 😞
0 Kudos
hidenori
Level 17

What I suggested was that you would need to add a text replacement item for your script using the Text Replacement tab in the SQL Scripts view. You still need to use the following statement, and will be replaced with the value of the DBNAMETODELETE property by the InstallShield runtime.

DROP DATABASE
0 Kudos
UNeverNo
Level 6

USE master
resolved the problem.
0 Kudos