cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tpattison
Level 3

Execute SQL scripts against multiple databases

I've searched the threads and cannot find exactly what I need.

I have a project that I need to create an installer to execute 5 SQL scripts against multiple databases on the same SQL instance. What my manager would like is a list box of databases on the SQL instance to be shown. Then have the ability to select the databases he wants to update and run the SQL against those databases. When the installer finishes return a log of the updates.

The SQL server engine will be SQL 2005. The installer will be run on the server itself via remote desktop so using SQLDMO is a viable option. The installer will be an InstallScript MSI project.

Thanks for any advice you can give me.

TPat
Labels (1)
0 Kudos
(3) Replies
hidenori
Level 17

You may want to consider using the SQL Scripts view in order to accomplish your requirement. In the view, you need to simply add a connection and the SQL scripts that you want to run against the target database server. At run-time, InstallShield automatically displays the SQLLogin dialog which has the server browse button and database catalog browse button. In the Target Database Catalog field, you can specify multiple database catalogs by separating them with a semi-colon, and InstallShield will run the SQL scripts associated with the connection against the specified database catalogs. One thing that you would need to elaborate is to use a multi-selection list box control in the Database Catalog Selection dialog, and create a semi-colon delimited list if more than one database catalog are selected.

Hope that helps.
0 Kudos
tpattison
Level 3

hidenori wrote:
You may want to consider using the SQL Scripts view in order to accomplish your requirement. In the view, you need to simply add a connection and the SQL scripts that you want to run against the target database server. At run-time, InstallShield automatically displays the SQLLogin dialog which has the server browse button and database catalog browse button. In the Target Database Catalog field, you can specify multiple database catalogs by separating them with a semi-colon, and InstallShield will run the SQL scripts associated with the connection against the specified database catalogs. One thing that you would need to elaborate is to use a multi-selection list box control in the Database Catalog Selection dialog, and create a semi-colon delimited list if more than one database catalog are selected.

Hope that helps.


I'm kind of new to this so a little more explanation would help. Are you saying I need to edit the Database Catalog Selection dialog? If so where is it as I can only find the SQLBrowse dialog. I want this to be as user friendly as possible for the end user hence the multi-select list box control.
0 Kudos
hidenori
Level 17

The SQLBrowse dialog is used for both Database Server Selection dialog and Database Catalog Selection dialog. So you would need to create a very similar dialog to the SQLBrowse dialog with a multi-selection list box control, and customize the SQLDatabaseBrowse and SQLServerSelectLogin2 functions so that the SQLLogin dialog will use the new browse dialog for the Database Catalog Selection dialog.
0 Kudos