SQL Express Scenario - Advanced Installer Community

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!

vulgrin
Posts: 40
Joined: Fri Jan 11, 2008 9:49 pm

SQL Express Scenario

Hi all, looking for some advice from people doing installs with SQL Express.

I will be distributing a database with the application, so my plan was to check to see if the user had SQL Express installed, if not, then give them the option to download and install it. (If the user chooses, they can create the database on their own SQL Server, and I already have that logic built into my dialogs.) I think that part is ok - in that I can download SQL Express and install it, creating my own instance for my app.

But, what if the user already has SQL Express installed? What I'd like to do is have SQL Express create my own instance for the app, but I can't figure out how to do this. Furthermore, I can't figure out where in the install to check for the existence of my instance and create it. I don't want to force the user to redownload SQLExpress if its already there, but I want my database to be attached to its own instance. (Or is this bad form and I should always use the default instance?)

Once the database software is installed, or my instance is created, is there anything special I will need to do to start that instance up so that I can start sending SQL commands to it during the install?

Finally, is there a good way to pass information to a SQL script from the installer, or to have the installer run a SQL script it generates from properties on the fly? I'm looking to attach my MDF / LDF files to a new database on the instance, and I'm going to need to know the path to the files, as picked by the user in the installer.

Whew - I have my work cut out for me. :) Thanks in advance for any help you can spare.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: SQL Express Scenario

Hi,
I will be distributing a database with the application, so my plan was to check to see if the user had SQL Express installed, if not, then give them the option to download and install it.
This can be done by adding SQL Server Express as a prerequisite. Note that the prerequisite's install condition should use a file or registry entry created only by the SQL Server Express installation.
what if the user already has SQL Express installed? What I'd like to do is have SQL Express create my own instance for the app, but I can't figure out how to do this.
You can do this by using the command line of the SQL Express prerequisite. For example, you can set the INSTANCENAME parameter.
I can't figure out where in the install to check for the existence of my instance and create it.
This can be done through another search performed by the prerequisite's install conditions.
is there anything special I will need to do to start that instance up so that I can start sending SQL commands to it during the install?
In order to connect to a specific instance all you need to do is specify the correct connection settings for that instance. This is done when you create the SQL connection.
is there a good way to pass information to a SQL script from the installer
The recommended approach is to include installer properties directly in the script. For this you can use the Script Replacement feature. Note that you should use public properties in your installation package.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”