Are you setting Property Id's with values?
E.g.

<Property Id="MYUSER" Value="Your username"/>
<Property Id="MYDATABASE" Value="Your database name"/>

Then:

       <Component Id="CreateUserAccount"
                   Guid="AEE91491-99FA-40A9-AB47-1E9FC2DDEF2A"
                   Directory="INSTALLDIR">
            <sql:SqlString Id="SqlLogin"
                           SQL="IF NOT EXISTS (SELECT * FROM sysusers WHERE
name='[MYUSER]')
                           BEGIN
                           EXEC sp_grantdbaccess '[MYUSER]'
                           END"
                           ExecuteOnInstall="yes"
                           SqlDb="[MYDATABASE]"/>
        </Component>


On Mon, Dec 15, 2014 at 8:53 AM, patrickpirzer <patrick.pir...@prosoft.net>
wrote:
>
> I want to create a new SQL Login, so i tried this with the following
> SqlString:
>
>         <Component Id="CreateUserAccount"
>                    Guid="AEE91491-99FA-40A9-AB47-1E9FC2DDEF2A"
>                    Directory="INSTALLDIR">
>             <sql:SqlString Id="SqlLogin"
>                            SQL="IF NOT EXISTS (SELECT * FROM sysusers WHERE
> name='[MyUser]')
>                            BEGIN
>                            EXEC sp_grantdbaccess '[MyUser]'
>                            END"
>                            ExecuteOnInstall="yes"
>                            SqlDb="[MyDatabase]"/>
>         </Component>
>
> Unfortunately the brackets around the variables like MyUser and MyDatabase
> are not accepted by the compiler.
> How can i use variables in the SqlString-element?
>
> Thanks in advance!
> Patrick
>
>
>
>
> --
> View this message in context:
> http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/How-can-i-use-variables-in-SqlString-tp7598582.html
> Sent from the wix-users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>


-- 
"They may forget what you said but they will never forget how you made them
feel." -- Anonymous
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to