如何向存储的 SQL 过程添加断点以进行调试?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3311764/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 06:55:27  来源:igfitidea点击:

How do I add breakpoints to a stored SQL Procedure for debugging?

sqldebuggingsql-server-2008breakpoints

提问by Raven Dreamer

I am trying to debug a SQL procedure, and am using the following query to do so.

我正在尝试调试 SQL 过程,并使用以下查询来执行此操作。

USE [database]
GO

DECLARE @return_value int

EXEC    @return_value = [dbo].[Populate]
        @ssId = 201

SELECT  'Return Value' = @return_value

GO

The problem is, the procedure I am testing, (Populate) doesn't seem to stop at any of the breakpoints I assign to it. Is there a different way to add breakpoints such that I can follow the debugger? I am getting the following error: "Invalid line number specified with SQL breakpoint".

问题是,我正在测试的过程(填充)似乎并没有在我分配给它的任何断点处停止。是否有不同的方法来添加断点,以便我可以跟随调试器?我收到以下错误:“SQL 断点指定的行号无效”。

采纳答案by DOK

Actually, if you have SQL Server 2008, you can once again debug in Management Studio.

实际上,如果您有 SQL Server 2008,您可以再次在 Management Studio 中进行调试

Each of these articles will take you through it step by step, with screenshots. It could hardly be easier.

这些文章中的每一篇都将带您一步一步地完成,并附有屏幕截图。再简单不过了。

SQL Server 2008: The Debugger is back

SQL Server 2008:调试器又回来了

T-SQL Debugger is back in SQL Server 2008 ... debugging now made easy

T-SQL 调试器又回到了 SQL Server 2008 中......调试现在变得简单

New Features in SQL Server 2008 Management Studio

SQL Server 2008 Management Studio 中的新功能

回答by Jaseer

1 Make a connection to a database. 2 Right-click the stored procedure, user-defined function, or trigger you want to work with and choose Open from the shortcut menu.

1 建立与数据库的连接。2 右键单击​​要使用的存储过程、用户定义函数或触发器,然后从快捷菜单中选择打开。

To insert a break point

插入断点

1.Right-click the line of SQL syntax in the editor window where you want to insert a breakpoints. 2.Point to Break point and then click Insert Break point.

1.在编辑器窗口中右键单击要插入断点的SQL语法行。2.指向断点,然后单击插入断点。