This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: SQL Database Already Exists
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 13, 2009
03:15 PM
SQL Database Already Exists
I have an InstallScript MSI project. In the SQL Scripts view I ran two scripts. 1 to create a database and 1 to add tables to the database. The install works fine the first time it is run. IF the install is run on a machine that already has the database on it then an error occurs and the install runs. What I need to do is only run the database scripts if the database does not exist. Is there a way in the InstallScript MSI project that I can check for that? Thank you.
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 13, 2009
03:40 PM
You have to do the check yourself in your SQL file. Basically something like:
if not exists(select * from sys.databases where name = 'Testing')
create database testing
if not exists(select * from sys.databases where name = 'Testing')
create database testing
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 14, 2009
07:01 AM
Thank you. I had thought to do it that way but wondered if IS would do it for me. 🙂