Interlude: Troubleshooting for 'no corresponding BEGIN TRANSACTION'

    xiaoxiao2021-12-14  24

    When you exec script like 

     

     

    begin tran 

    exec tonytest 

    rollback tran 

    commit tran 

     

    You will see an error like  

     

    Msg 3902, Level 16, State 1, Line 4 

    The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION. 

     

    To debug, just make sure only one of rollback and commit works in the same time. 

    In this case, just delete commit, then bug disappear. 

     

    It could be obvious to find out in this script because it's simple, 

    But when you making a script really complex, it could be hard to find out this bug. 

    转载请注明原文地址: https://ju.6miu.com/read-963293.html

    最新回复(0)