WiX Toolset

SqlDatabase Element (Sql Extension)

SQL Database
Windows Installer references
Component, Fragment, Module, Product
Inner Text
Choice of elements (min: 0, max: unbounded)
Name Type Description Required
Id String   Yes
ConfirmOverwrite YesNoType    
ContinueOnError YesNoType    
CreateOnInstall YesNoType    
CreateOnReinstall YesNoType Specifies whether to create the database when the associated component is reinstalled. Setting CreateOnInstall to yes does not imply CreateOnReinstall is set to yes. CreateOnReinstall must be set in addition to CreateOnInstall for it to be created during both install and reinstall.  
CreateOnUninstall YesNoType    
Database String The name of the database. The value can be a literal value or derived from a Property element using the Formatted syntax. Yes
DropOnInstall YesNoType    
DropOnReinstall YesNoType Specifies whether to drop the database when the associated component is reinstalled. Setting DropOnInstall to yes does not imply DropOnReinstall is set to yes. DropOnReinstall must be set in addition to DropOnInstall for it to be dropped during both install and reinstall.  
DropOnUninstall YesNoType    
Instance String    
Server String   Yes
User String    
Nesting SqlDatabase under a Component element will result in a SqlDatabase being installed to the machine as the package is installed.
Nesting SqlDatabase under Product, Fragment, or Module results in a database "locator" record being created in the SqlDatabase table. This means that the database itself is neither installed nor uninstalled by the MSI package. It does make the database available for referencing from a SqlString or SqlScript record. This allows MSI to install SqlScripts or SqlStrings to already existing databases on the machine. The install will fail if the database does not exist in these cases.
The User attribute references credentials specified in a User element. If a user is not specified then Windows Authentication will be used by default using the credentials of the user performing the install to execute sql strings, etc.
See Also
Sql Schema, User