About Controlling SQL Execution

Feature Only in Enterprise Edition   This feature is supported only in Visual C++ Enterprise Edition. For more information, see Visual C++ Editions.

To control SQL source code execution, click the Go, Step Into, or Run To Cursor command under Start Debug on the Build menu. The following table lists the Start Debug commands and their actions.

Build Menu Debug Commands

Build menu command
Action
Debug Displays the initial debug commands: Go, Step Into, Run to Cursor.
Go Executes code from the current statement until a breakpoint is reached or the end of the program is reached. This is equivalent to the Go button on the toolbar.
Step Into Single-steps through statements in the SQL source code.
Run to Cursor Executes the program as far as the line that contains the insertion point. This is equivalent to setting a temporary breakpoint at the insertion point location.

After you click Go, Step Into, or Run to Cursor, the Debug menu appears, replacing the Build menu on the menu bar. You can then control program execution using the commands listed in the following table.

Debug Menu Commands That Control SQL Execution

Debug menu command
Action
Go Executes code from the current statement until a breakpoint is reached, the end of the program is reached, or an exception occurs. When the Debug menu is unavailable, you can click Go from the Start Debug submenu of the Build menu.
Restart Resets execution to the first line of the application.
Stop Debugging Terminates the debugging session and returns to a normal editing session.
Break Halts the SQL source code or client application at its current location.
Step Into Single-steps through statements in the SQL source. When the Debug menu is unavailable, you can click Step Into from the Start Debug submenu of the Build menu. If the SQL code is not encrypted, you can Step Into, Step Over, and Step Out.
Step Over Single-steps through statements in the SQL source code.
Step Out Executes the current SQL source code and returns to the next higher nesting level or currently executing client application instruction. Using this command, you can quickly finish executing the current SQL code. The maximum nesting level for SQL Server is 16.
Run to Cursor Executes the SQL code up to the line that contains the insertion point. This command is equivalent to setting a temporary breakpoint at the insertion point location. When the Debug menu is unavailable, you can click Run To Cursor from the Start Debug submenu of the Build menu. Other debugging events, such as breakpoints, will clear the temporary breakpoint.