tags:

views:

25

answers:

2

Hi Ant guru, I got error BUILD FAILED C:\Projects...\build.xml:987: com.microsoft.sqlserver.jdbc.SQLServerException: The procedure 'sys.sp_addlogin' cannot be executed within a transaction. How can i make an ant sql task run this?

thanks

A: 

Try use CREATE LOGIN instead of sp_addlogin

http://msdn.microsoft.com/en-us/library/ms189751.aspx

Michael Pakhantsov
A: 

Well that I tried too but since I couldn't change the SQL script I found a walk around by using executable

        <exec executable="sqlcmd" >
            <arg value= "-S"/>
            <arg value= "${ServerName}"/>
            <arg value="-d"/>
            <arg value="DataBaseName"/>
            <arg value="-i"/>
            <arg value="${build.sql}/mssql/script.sql"/>
            <arg value="-E"/>
            <arg value="-b"/>
        </exec>
Kate Khapatko