We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

ArnieC
Posts: 2
Joined: Wed Jan 11, 2017 2:09 pm

SQL Database Installation from Script Files | Multiple Databases

I am very new to Advanced Installer and are faced with a database installation project that involves the following and was wondering how this would get accomplished using Advanced Installer.

Background:
When we develop our SQL solutions we typically have one or more folders with .sql script files (stored procedures, views, data, tables, etc.) in them.
Each folder includes a .ini file referencing each script file to be deployed and the order in which it should get deployed to the target database
For scripts that need to be deployed to multiple databases we have a db.ini file that reference the database names to which the scripts should get deployed too. Any script files starting with db_ needs to be deployed to the list of databases in the db.ini file.

Questions:
1. Will the Advanced Installer read updated .sql files from the source folder(s) at compile time?
2. Can Advanced Installer read the .ini file to get the .SQL files to be added to the deployment project at compile time?
3. How would I setup the project to allow for executing one or more .sql scripts against the list of databases in the db.ini file, i.e. can Advanced Installer be setup to loop through the databases in the db.ini file executing the same set of .sql script files with each iteration?
4. If the script file(s) includes for example PRINT statements that would typically produce message output if run in SSMS, can these output messages be captured in an Advanced Installer log file?

Thank you for any advise, tips, tricks or ideas you can offer.
ArnieC
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: SQL Database Installation from Script Files | Multiple Databases

Hello Arnie,
1. Will the Advanced Installer read updated .sql files from the source folder(s) at compile time?
Yes, every time you build the setup project Advanced Installer will read the content of your SQL file from disk and embed it in the setup package at build time.
2. Can Advanced Installer read the .ini file to get the .SQL files to be added to the deployment project at compile time?
No, I'm afraid we don't have built-in support for this requirement.
3. How would I setup the project to allow for executing one or more .sql scripts against the list of databases in the db.ini file, i.e. can Advanced Installer be setup to loop through the databases in the db.ini file executing the same set of .sql script files with each iteration?
We don't have predefined support for this requirement either. For this you will have to execute a loop statement into your SQL Script code to run the script for all of the required databases. The databases name could be passed into the SQL Script code at install time using our "SQL Script Replacement" support.
4. If the script file(s) includes for example PRINT statements that would typically produce message output if run in SSMS, can these output messages be captured in an Advanced Installer log file?
I'm afraid this is not possible.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”