Installing MSSQL Together With Software Application

You want to install MSSQL and your software application together in the same installer without having to run through separate installers (in a Windows environment). You intended to run the installation from a CD where users only have to click once.

So, how do you invoke the MSSQL installer from other installer ? Assuming that you are using Visual Studio Installer to build the installer for your software application, you can't.

You can't even run batch file (*.bat file) from it.

You have to resort to either of the followings:

  1. Custom made installer.
  2. Using installation studio which supports custom scripts such as Wise Installation Studio. (Which is not free)

The best solution that I could figure out is:

To invoke the MSSQL installer using command prompt.

Check it out..

MSSQL 2005
MSSQL 2008

It works, you can put the script inside a batch file.

And instead of trying to use the installer for your software application to invoke the batch file, you can actually invoke everything from a batch file (including your software application installer).

Thus, the content of your eventual installation CD would look like the following.

The content of SetupTAS.bat is:

Or download it from here.

So, the idea is to run everything from command prompt with scripts in a batch file. Use the 'osql' utility to execute T-SQL scripts from command prompt.

Also, you can download the ISO image of the example shown above from here.

Other Issues:
  • You may want to create a custom installer to execute the batch file (SetupTAS.bat) because you don't want to expose end-users with the 'sa' password. You may also want to compress the batch file and T-SQL scripts into a zip file and password protect it.
  • You may also want to disable Windows Users from having access to the database for extended security; allowing only 'sa' access.
  • You may also want to use the sac.exe utility to configure settings for the database instance installed.
  • You may also want to perform a check on dotNetFramework version before process with installing MSSQL 2005 which requires at least version 2

Pretty neat huh ?


Brandon Teoh said…
check out the revised solution here (to work better with Windows Vista)