Execute SQL command from MSI (Windows Installer Editor)
I am using Window Installer Editor 7.0 and have a .WSI. I need to execute a .sql file utilizing SQLCMD.exe. I need the user’s credentials which I get from a dialog window. I'd like to add an action to when the user clicks "Next >" it would launch my .sql (with the recently add credentials) and depending on the exit code, continue the installation or pop up a dialog.
Community Chosen Answer
You could create a dialog in your MSI to gather the user's data for the SQL login, link the data they enter to properties, then create a custom action to run the SQLCMD command, using said properties.
Be aware that if you want to run the custom action in deferred context you won't be able to access the property values, so you'll either want to make them available throuh the CustomActionData property, or run your CA in immediate context.
As a sidenote, if you have access to an AdminStudio installation, it contains custom tools for inserting SQL statements into an MSI installer.
EDIT: as a matter of fact, just noticed Wise has this too.. using an SQL connection dialog, the WISE_SQL_CONN_STR property and the SQL Server Scripts tool.