如何调试从 SQL Server 2008 中的 Service Broker 队列运行的存储过程?

发布于 2024-12-09 02:03:23 字数 181 浏览 6 评论 0原文

我有一个带有复杂触发器的表,该触发器最终调用 Service Broker 来运行带有表(自定义类型)参数的存储过程。

我可以“步入”插入和触发器,但我无法步入服务代理存储过程,因为据我所知,它是异步运行的。

有什么方法可以利用 Service Broker 运行的存储过程并对其进行调试吗?

谢谢。

I have a table with a complex trigger that eventually calls the Service Broker to run a stored procedure with a parameter that is a table (custom type).

I can "step into" the INSERT and the trigger, but I can't step into the service broker stored procedure, as it runs async as far as I understand.

Is there any way to tap into the stored procedure that the Service Broker runs and debug it?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝眼睛不忧郁 2024-12-16 02:03:23

要调试它(使用 Management Studio 调试器),您可以更改队列以关闭激活。

ALTER QUEUE queue_name 
WITH ACTIVATION (STATUS = OFF); 

运行 insert 语句,然后运行 ​​&手动调试激活过程,就像调试任何存储过程一样。
这样,当您调试时,队列中就会有一些东西。
然后,完成后使用 STATUS = ON 恢复激活。

To debug it (using the management studio debugger) you could alter the queue to set activation off.

ALTER QUEUE queue_name 
WITH ACTIVATION (STATUS = OFF); 

run the insert statement then run & debug the activation procedure manually just like you would with any stored procedure.
This way there will be something in the queue while you debug.
Then when finished use STATUS = ON to restore activation.

祁梦 2024-12-16 02:03:23

我知道这已经很旧了,但也许其他人也有这个问题。

您可以使用 SQL Profiler 捕获发生错误的行号和过程。如果您使用打印语句,那么它们将显示在分析器中。

I know this is old but maybe someone else has this problem.

You can use SQL Profiler to catch the line number and proc where an error is happening. If you use Print statements then they will show up in the profiler.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文