Peter,

I am not sure of all the details, but try saving the SQL script as ANSI
format. 

Michael 

-----Original Message-----
From: Peter McClymont [mailto:[EMAIL PROTECTED] 
Sent: Friday, 28 November 2008 11:01 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Running SQL scripts under WIX

Hi All,

I have a rather disturbing problem that I am having a lot of trouble
figuring out.

Our WIX installer is adding a database, and running a SQL script as it
does the install. It looks like this,

<Binary Id="CreateTableScript"
SourceFile="$(var.iC3.TargetDir)\SQLScripts\CreateTables.sql" />

<Directory Id="TARGETDIR" Name="SourceDir" FileSource=".\">
      <Directory Id="ProgramFilesFolder">
        <Directory Id='Dir' Name="Company Name">
          <Directory Id="INSTALLLOCATION" Name="Product Name" >
            <Component Id="MainDatabase"
Guid="dd6f7b80-bcbb-11dd-ad8b-0800200c9a66">
              <sql:SqlDatabase Id="MainDatabase" Database="Database"
CreateOnInstall="yes" Instance="SQLExpress" Server="localhost"
DropOnUninstall="yes" ContinueOnError="yes">
                <sql:SqlScript Id="CreateDatabaseTables"
BinaryKey="CreateTableScript" ContinueOnError="no"
ExecuteOnInstall="yes"/>
              </sql:SqlDatabase>
            </Component>
            <Directory Id="ArchiveDirectory" Name="Archive" />
          </Directory>
        </Directory>
      </Directory>

And the SQL script looks like this (the first part anyway),

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[CollectedBatchStore](
    [uid] [int] IDENTITY(1,1) NOT NULL,
    [CollectedBatchStoreName] [nvarchar](50) NOT NULL,
    [DataType] [smallint] NOT NULL,
 CONSTRAINT [PK_dbo.CollectedBatchStore] PRIMARY KEY CLUSTERED (


ETC ETC

Anyway it all compiles properly, but when I run the installer it
complains with an error message,

Error -2147217900: failed to execute SQL string. Incorrect syntax near
'>>'
(this is a funny character which has 2 arrows in one character)

I look at the SQL profiler to see what SQL it is running, and I see
this,

Drop database Database
Create database Database
exec i>>?SET ANSI_NULLS ON

You see after the exec above there are a few funny characters, and it
should be starting at the 'SET ANSI_NULL ON' part of that statement. I
don't understand where the characters are coming from.

Thanks,

Peter.
------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge Build the coolest Linux based applications with Moblin SDK &
win great prizes Grand prize is a trip for two to an Open Source event
anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to