SQL Server Profiler:如何在死锁图中显示查询参数值?
我正在尝试使用 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:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您最好的选择可能是在您的配置文件中也包含“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.