• You can try this solution :

    Create a Wrapper.sql with a Transaction defined in it, and within that transaction use :r to call other scripts. Here is an example:

    --Wrapper.sql

    :On Error Exit

    SET XACT_ABORT ON

    GO

    Begin Transaction

    Use <DBNAme>

    :r <Script1.sql>

    :r <Script2.sql>

    Use <DBNAme2>

    :r <Script1.sql>

    :r <Script2.sql>

    If Xact_State()=1

    Begin

    Print 'Committing Tranaction...'

    Commit tran

    End

    Else If Xact_State()=-1

    Begin

    Print 'Rolling Back Transaction...'

    RollBack Tran

    End

    Then call this Wrapper.sql from SQLCMD.

    I have used this approach, and it has worked for me.

    Thanks,