Debugging a Stored Procedure
From SQLBWiki
SQLBrowser implements a simple step-by-step debugger by merely sending executables statements one by one to the server. The state of local variables is kept, which allows for substitution when sending statements. There are two main usages of the debugger:
- to understand at what point a stored procedure does not behave the way expected
- to tune a stored procedure
In both cases, local variables, cursors and temp tables are present in the context, which greately helps debugging compared to doing it by hand.
[edit] Steps to debug a stored procedure
- Open the server on which you want to debug a stored procedure
- Open a New File and type the invocation of the stored procedure
- Click on Start Debugger
- Click on Step Into to enter the debugged stored procedure body
- Step into / over the executable statements
- At any time, you can replay any statement
- You can toggle break points by clicking in the line number gutter
- Once you have reached the end of the debugged stored procedure, or if you press Stop before the end, you are presented a summary of all statements IOs. This helps spotting statements with long IOs
- To comletely stop the debugger, press Stop again






