SqlDatabase Element

WiX Help

SqlDatabase Element

Description

SQL Database

Windows Installer references
None
Parents
Component, Fragment, Include, Module, Product
Inner Text
None
Children
Choice of elements (min: 0, max: unbounded)
Attributes
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. If the name does not follow the SQL server "Rules for Regular Identifiers" (see MSDN) it must be surrounded by quotes or square brackets. Since this value can be formatted text, this means that if you choose to use square brackets you must use the MSI method for escaping square brackets, for example: [\[]blah[\]]. 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    
Remarks
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 cridentials specified in a User element. If a user is not specified then Windows Authentication will be used by default using the cridentials of the user performing the install to execute sql strings, etc.
See Also
Wix Schema, User