你最喜欢的调试MS SQL存储过程的方法是什么? [英] What's your favored method for debugging MS SQL stored procedures?

查看:128
本文介绍了你最喜欢的调试MS SQL存储过程的方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的大多数SP可以简单地用手动输入的数据执行(和测试)。这样做很好,使用简单的PRINT语句允许我进行调试。

Most of my SPs can simply be executed (and tested) with data entered manually. This works well and using simple PRINT statements allows me to "debug".

然而,存在多个存储过程的情况,并且找到有效的输入数据是乏味的。我的网络应用程序中触发的东西更容易。

There are however cases where more than one stored procedure is involved and finding valid data to input is tedious. It's easier to just trigger things from within my web app.

我有一点经验,但我没有找到一种方法来探索发生了什么事在我的存储过程中。

I have a little experience with the profiler but I haven't found a way to explore what's going on line by line in my stored procedures.

您的方法是什么?

一如既往,谢谢。

注意:我假设使用SQL Server 2005 +

Note: I'm assuming use of SQL Server 2005+

推荐答案

Profiler非常方便,只需添加SP:StmtStarting事件,并通过设置SPID = xxx将活动过滤到您的进程。一旦你设置好了,看看发生了什么,这样很轻松。

Profiler is very handy, just add SP:StmtStarting events, and filter the activity down to just your process by setting SPID=xxx. Once you have it set up, it's a breeze to see what's going on.

这篇关于你最喜欢的调试MS SQL存储过程的方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆