SQL Server Profiler:如何在死锁图中显示查询参数值?

发布于 2024-08-15 08:07:23 字数 396 浏览 4 评论 0原文

我正在尝试使用 SQL Server Profiler 2008 调试死锁。我知道如何在探查器中获取死锁图表,但是当我将鼠标悬停在图表中所示的两个语句之一上时,“语句”工具提示显示出现仅包含带有参数名称的查询,而不包含值。

换句话说,我得到这样的工具提示:

DELETE FROM users WHERE id = @id

如何查看相应的参数值?此屏幕截图:

“在此处输入图像描述"展示了我想看到的东西,所以一定有办法。

I'm trying to debug a deadlock with SQL Server Profiler 2008. I know how to get a graph of the deadlock in the profiler, but when I hover over one of the two statements in shown in the graph, the "Statement" tooltip that appears only contains the query with parameter names, not values.

In other words I get tooltips like this:

DELETE FROM users WHERE id = @id

How can I see the corresponding parameter values? This screenshot:

enter image description here
shows what I would like to see, so there must be a way.

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

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

发布评论

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

评论(1

桃扇骨 2024-08-22 08:07:23

您最好的选择可能是在您的配置文件中也包含“SQL:StatementStarting”,然后向上滚动列表查找属于死锁的 SPID。这不是一个简单的方法,但如果语句是参数化 SQL 与常规语句,则 SQL Profiler 会以不同的方式记录这些语句。在您的照片中,看起来它显示的是非参数化的语句,但您的问题似乎是关于参数化的语句。

我之前曾遇到过这个问题,试图准确地弄清楚应用程序发送到 SQL Server 的内容 - 我所能看到的只是参数化查询,而这对我没有任何帮助。

Your best bet is probably to also include "SQL:StatementStarting" in your profile and then just scroll up the list looking for the SPIDs that were part of the deadlock. That's not an easy way to do it, but SQL Profiler records the statements differently if they were parameterized SQL vs. a regular statement. In your photo, it looks like it's showing a non-parameterized statement, but your question seems to be about one that's parameterized.

I've had this problem before with trying to figure out exactly what an application was sending to SQL Server - all I could see was the parameterized query, and that wasn't helping me at all.

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