How can I debug stored procedures in SQL Server 2008 management studio?
I am trying to put a break point on SQL query and then press start debugging but I get an error that debugging cannot be started on my machine:
Debug cannot be started at <machine name>.
I don't want to use CLR debugging. How can I debug stored procedures?
To debugging SP, go to database->Programmability->Stored Procedures-> right click the procedure you want to debug->select Debug Procedure.
As with debugging in other programming languages, you can view and modify local variables and parameters, view global variables, as well as control and manage breakpoints while debugging your Transact-SQL script. This example shows how to create and debug a Transact-SQL stored procedure by stepping into it.
You can start the debugger by either clicking the Debug button on the Query toolbar or by clicking Start Debugging on the Debug menu or pressing ALT+F5.
SQL Developer's default “debug” action is to run until a breakpoint occurs. You can change this by going to Tools > Preferences, and clicking Debugger. Change the option that says “Start Debugging Option” to Step Into. This will allow you to click Debug and run to the first line of code.
Type exec YourStoredProcedure
. Put break point next to it. Hit green (debug) arrow next to execute button. Debugger should start and hit your break point. Hit F11 to step into your stored procedure.
See debug menu for more options.
Here is very detailed blog post: T-SQL Debugger for SQL Server 2008
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With