addlogin in ant sql task?

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


Try use CREATE LOGIN instead of sp_addlogin

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


那么我也尝试过,但因为我无法更改SQL脚本,所以我找到了使用可执行文件的步骤

        <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>
链接地址: http://www.djcxy.com/p/7714.html

上一篇: 在Eclipse中导入ant build.xml

下一篇: 在sql的任务中添加登录?