调试 SQL Server 2008 中的存储过程
有什么方法可以调试 SQL Server 2008 上的存储过程?
Is there any way to debug a stored procedure on SQL Server 2008?
我有权使用 SQL Server Management Studio 2008 和 Visual Studio 2008(不确定两者是否提供此功能).
I have access to use SQL Server Management Studio 2008 and Visual Studio 2008 (not sure whether either provides this functionality).
通常我使用 SQL 分析器来查找传递给存储过程的参数,但是希望能够逐步执行该过程以查看它在哪里失败.
Generally I use the SQL profiler to find the parameters passed to the stored proc, however would like to be able to step through the procedure to see where it is failing.
这可能吗?
最好的方法是什么?(在快速查找bug位置方面)
What is the best way? (in terms of quickly finding location of bugs)
推荐答案
答案一直就在我面前.
在 SQL Server Management Studio 2008 中,工具栏中有一个调试按钮.在查询窗口中设置断点以单步执行.
In SQL Server Management Studio 2008 there is a Debug button in the toolbar. Set a break point in a query window to step through.
我一开始就忽略了这个功能,因为我没有想过进入存储过程,你可以轻松地做到这一点.
I dismissed this functionality at the beginning because I didn't think of stepping INTO the stored procedure, which you can do with ease.
SSMS 基本上会自动执行 FinnNK 在 MSDN 演练中提到的内容.
SSMS basically does what FinnNK mentioned with the MSDN walkthrough but automatically.
太简单了!感谢您的帮助 FinnNK.
So easy! Thanks for your help FinnNK.
我应该在那里添加一个步骤来查找我在数据库上使用 SQL Profiler 的参数的存储过程调用.
I should add a step in there to find the stored procedure call with parameters I used SQL Profiler on my database.
相关文章