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.

本文介绍了一个常见的SQL事务处理错误:提交事务请求时找不到对应的开始事务指令。通过一个简单的示例展示了如何定位并修复该错误,强调了在复杂脚本中排查此类问题的重要性。
1128

被折叠的 条评论
为什么被折叠?



