EXECUTE 后的事务计数表示缺少 COMMIT 或 ROLLBACK TRANSACTION 语句 - SQL Server 2005 [英] Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing - SQL server 2005

查看:25
本文介绍了EXECUTE 后的事务计数表示缺少 COMMIT 或 ROLLBACK TRANSACTION 语句 - SQL Server 2005的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 SQL Server 2005 中从应用程序中得到如下错误

I am getting the error from the application as following with SQL server 2005

"EXECUTE 后的交易计数表示 COMMIT 或 ROLLBACK缺少 TRANSACTION 语句.先前计数 = 1,当前计数 =0"

"Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 1, current count = 0"

如何找到引发此错误的阶段?

How can I find the stage where this error is raised?

如何找到丢失的事务或未提交或未回滚的存储过程?

How can I find the missing transaction or the stored procedure where it is not committed or getting rolled back?

推荐答案

我不认为缺少任何东西.它可能是从事务内部调用的内部存储过程 (TRANCOUNT = 1),启动它自己的事务 (TRANCOUNT = 2),然后将其回滚.嗯,意思是回滚,但是回滚会影响所有事务,而不是最里面的事务,所以程序搞砸了执行流程.

I don't think anything is missing. It's probably an inner stored procedure that gets called from inside a transaction (TRANCOUNT = 1), starts its own transaction (TRANCOUNT = 2) and then rolls it back. Well, it means to roll it back, but rollback affects all transactions and not only the innermost one, so the procedure screws up the execution flow.

找到地点的方法取决于可用的工具/技能.更好的方法是使用 SQL Profiler 来显示应用程序针对服务器执行的所有命令.找出最外层的存储过程并检查其代码以查找任何其他过程调用.

A way to find the place depends on available tools/skills. A better way is to use SQL Profiler that shows all commands executed by an application against the server. Find out the outermost stored procedure and go through its code looking for any other procedure calls.

这篇关于EXECUTE 后的事务计数表示缺少 COMMIT 或 ROLLBACK TRANSACTION 语句 - SQL Server 2005的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆