本文介绍了如何监视SQL Server 2005上已执行的sql语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的一个项目中,针对SQL Server执行的SQL语句由于某些未知原因而失败.一些代码已经在生产中使用,因此调试它不是一件容易的事.因此,我需要一种在数据库本身中查看使用什么SQL语句的方法,因为这些语句是由项目在运行时生成的,并且在满足某些条件时可能存在缺陷.

In a project of mine the SQL statements that are executed against a SQL Server are failing for some unknown reason. Some of the code is already used in production so debugging it is not an easy task. Therefore I need a way to see in the database itself what SQL statements are used, as the statements are generated at runtime by the project and could be flawed when certain conditions are met.

因此,我考虑了监视传入语句并检查自己是否有任何缺陷的可能性.

I therefore considered the possibility to monitor the incoming statements and check myself if I see any flaws.

该数据库在SQL Server 2005上运行,我使用SQL Server Management Studio Express作为操作数据库的主要工具.所以我的问题是,做到这一点的最佳方法是什么?

The database is running on a SQL Server 2005, and I use SQL server management studio express as primary tool to manipulate the database. So my question is, what is the best way to do this?

推荐答案

看到您如何使用Management Studio Express,我将假定您无权使用MSSQL 2005客户端工具.如果这样做,请安装它们,因为它包括SQL Profiler,它可以完全满足您的要求(甚至更多!).有关该信息的更多信息,请参见 msdn .

Seeing how you use the Management Studio Express, I will assume you don't have access to the MSSQL 2005 client tools. If you do, install those, because it includes the SQL profiler which does exactly what you want (and more!). For more info about that one, see msdn.

前一段时间,我发现,因为我在考虑完全相同的事情.我本人可以访问客户端工具,因此我确实不需要,但是访问不是无限的(这是我目前的工作).如果您尝试一下,请告诉我它是否有效;-)

I found this a while ago, because I was thinking about the exact same thing. I have access to the client tools myself, so I don't really need to yet, but that access is not unlimited (it's through my current job). If you try it out, let me know if it works ;-)

这篇关于如何监视SQL Server 2005上已执行的sql语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 23:34