Summary
This article explains how to conditionally run SQL scripts during uninstall.
Synopsis
The SQL Scripts are explicitly tied to component states. The condition that you are setting in the SQL view is actually the condition on the underlying component. Therefore, the condition does not affect during uninstall as Windows Installer removes all installed components regardless of their conditions. If you would like to conditionally run SQL scripts during uninstall, you need to add the conditional statement to your scripts.
Discussion
The following instruction illustrates how to create a setup that will drop the 'MyDB' database during uninstall only when the SQL_SCRIPTS_DROPDB property is set to '1' .
- Create a new Basic MSI project.
- Navigate to SQL Scripts view.
- Add a new connection and a SQL script.
- Click the Runtime tab and check "Run Script During Uninstall" and uncheck "Run Script During Install".
- Click the Script tab and add the following statements:
If ?%SQL_SCRIPTS_DROPDB%? = ?1? BEGIN DROP DATABASE [MyDB] END - Click Text Replacement tab and add the following entry
Find What: %SQL_SCRIPTS_DROPDB% Replace With: [SQL_SCRIPTS_DROPDB] - Build a project release.
Related Articles
InstallShield ignores some errors in SQL scripts 5Number of Views Perfom a bulk insert into Database using Sql Scripts view 4Number of Views SQL script to check the database permissions for LicenseManagerUser 139Number of Views Make a Property Available During Uninstall Maintenance and During Patching 4Number of Views Add/Remove Programs Hangs When Launching an Application During Uninstall 6Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago