您的位置:首页 > 数据库 > SQL

Interlude: Troubleshooting for 'no corresponding BEGIN TRANSACTION'

2016-12-02 12:57 507 查看
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. 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息