[wix-users] Override Sql DB in WiX
Ven H
venh.123 at gmail.com
Wed Mar 7 09:01:09 PST 2018
I have an SQL script CREATE_TABLE.sql which has the following statement
use MsiTestDB
go
if not exists( select 1 from information_schema.tables where table_name =
'EMPLOYEES' )
begin
create table dbo.EMPLOYEES
(
EMP_ID INT NOT NULL,
EMP_NAME NVARCHAR(100) NOT NULL
)
end
go
I have the following markup in my wxs file.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="
http://schemas.microsoft.com/wix/UtilExtension" xmlns:sql="
http://schemas.microsoft.com/wix/SqlExtension">
<Fragment>
<util:User Id="SQLUser" Name="[SQLUSER]" Password="[SQLPASSWORD]" />
<Binary Id="binCreateTbl" SourceFile="CREATE_TABLE.sql" />
<Component Id="dbComp" Guid="329600D4-F7F4-4038-9963-4A4C25D5AE7F"
Directory="INSTALLFOLDER" KeyPath="yes">
<sql:SqlDatabase Id="msiTestDB"
Database="[SQLDB]"
Server="[SQLSERVER]" Instance="[SQLINSTANCE]"
CreateOnInstall="yes"
User="SQLUser" />
<sql:SqlScript BinaryKey="binCreateTbl" Id="script_CreateTbl"
ExecuteOnInstall="yes" ContinueOnError="no" SqlDb="msiTestDB" />
</Component>
</Fragment>
</Wix>
The properties (within square brackets) are provided from the UI. The SQL
Script has a "Use MsiTestDB" statement. So, even if I pass a new and
different value for the SQLDB property from the UI, it always executes and
creates the table in the MsiTestDB. Is it possible in WiX to workaround or
override this behavior?
Regards,
Venkatesh
More information about the wix-users
mailing list