This topic describes different navigation techniques while debugging stored database objects.
One of the most common debugging procedures is stepping. Stepping is executing one line of a code at a time.
The Debug menu provides three commands for stepping through code:
Step Into and Step Over differ in only one aspect, the way they handle function calls. Either command instructs the debugger to execute the next line of the code. If the line contains a function call, Step Into executes only the call itself, then halts at the first line of the code inside the function.
Step Over executes the entire function, then halts at the first line outside the function. Use Step Into if you want to look inside the function call. Use Step Over if you want to avoid stepping into functions.
On a nested function call, Step Into steps into the most deeply nested function. If you use Step Into on a call like Func1(Func2()), the debugger steps into the function Func2.
Use Step Out when you are inside a function call and want to return to the calling function. Step Out resumes execution of your code until the function returns, then breaks at the return point in the calling function.
The debugger breaks execution of the code when execution reaches a breakpoint. You can select Continue, Step Into, Step Over, Step Out on the Debug menu to continue the execution.
Stop debugging means terminating the debugging session. It should not be confused with breaking execution, which temporarily halts execution of the process you are debugging but leaves the debugging session active.
To stop debugging process, click Stop Debugging on the Debug menu.
If the module is compiled for debugging, the debug execution is paused at the last line of the code allowing you to investigate the state of the program variables in the Watches window. If the module was not complied for debugging, T-SQL Database Objects execution is not broken at the last line.
If you want to stop the run you are currently debugging and immediately begin a new run, you can use the Restart command. Current debug session will be terminated and a new one will start.
Stopping execution means terminating the program you are debugging and completing the debugging process. It differs from breaking execution, which temporarily halts debugging session but leaves it active.
Stop Debugging does not always terminate the program. It stops the process, being in the break mode. Otherwise, it fulfills finalizing the program in the background mode, so that you can begin a new debugging session. Only two instances of the program can be started for debug and terminated in the background mode. The next debugging process will be available only after one of the programs, being terminated, stops running.