cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
vickenk
Level 4

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.
Labels (1)
0 Kudos
(1) Reply
hidenori
Level 17

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.
0 Kudos