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
- :
- How to check if SQL database (catalog) already exists or not
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
Nov 24, 2011
10:59 AM
How to check if SQL database (catalog) already exists or not
Hello,
In my installation project (InstallShield 2012 MSI) I have SQLLogin dialog which captures SQL Server connection information to eventually execute a number of sql scripts against the server. My intention is to ignore the execution of these scripts when database catalog found to already exists.
What is the simplest way to check whether the database name entered at SQLLogin already exists on the server or not (I don’t want to accomplish this via SQL statement i.e. IF NOT EXISTS CREATE DATABASE…).
I came across SQLRTGetDatabases() function but I am not exactly sure how to use it due to the lack of examples.
Any help will be appreciated. Cheers.
In my installation project (InstallShield 2012 MSI) I have SQLLogin dialog which captures SQL Server connection information to eventually execute a number of sql scripts against the server. My intention is to ignore the execution of these scripts when database catalog found to already exists.
What is the simplest way to check whether the database name entered at SQLLogin already exists on the server or not (I don’t want to accomplish this via SQL statement i.e. IF NOT EXISTS CREATE DATABASE…).
I came across SQLRTGetDatabases() function but I am not exactly sure how to use it due to the lack of examples.
Any help will be appreciated. Cheers.
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Nov 28, 2011
11:34 AM
One thing you can try is to call the ISSQLQueryDatabases action which finds database catalogs that are available on a specified database server. After calling that built-in action, call your own custom action that will search for the desired database catalog name in the 'IS_SQLSERVER_LIST' list box control items. See Knowledge Base article Q103295 for a sample code on how to access to list box/combo box control items at runtime.
Hope that helps.
Hope that helps.