The easiest way is to run the sqlcmd.exe installer to run the sql script. To call this, you need to know the data source (location) of the sql instance. You will need to get this from the user. For example, machine name, machine name \ instancename or typically sqlexpress - machine name \ SQLExpress.
http://msdn.microsoft.com/en-us/library/ms165702.aspx
You can also complete the prepaid step and install sqlexpress for your client. There cmdline is installed:
http://msdn.microsoft.com/en-us/library/ms144259.aspx
Another option without sql dependencies is to create your own custom action (command line / API), parse between GO statements in a script, and execute using ADO.net.
Another option outside of installation is the separation of settings and configurations. The installer installs only the bits, and the database is created at runtime through the configuration phase of the product runtime. This has many advantages, including the ability to update your bits (either with a patch or automatically) after the setup phase and before the setup phase. You can also give a better interactive experience and deal with runtime problems - with tuning, your choice is a bad setup and rollback, which is a bad experience.
Hope this helps.
source share