How to: Step into an Object Using Server Explorer

This topic applies to:

Visual Studio Ultimate

Visual Studio Premium

Visual Studio Professional

Visual Studio Express

ms165041.DoesApplybmp(en-us,VS.100).gif ms165041.DoesApplybmp(en-us,VS.100).gif ms165041.DoesApplybmp(en-us,VS.100).gif ms165041.DoesNotApplybmp(en-us,VS.100).gif

The following procedure describes how to use the Visual Studio Server Explorer to start debugging by stepping into a database object. This method of Transact-SQL debugging is known as Direct Database Debugging, and can be done in Visual Studio outside of any project if need be. You can step into stored procedures and user-defined functions (UDFs). To debug any other object, you must reference it from a stored procedure or UDF, or cause it to fire, in the case of triggers, and start debugging by stepping into the procedure or function.

To step into an object by means of Server Explorer

  1. In Server Explorer, if you have not already done so, establish a connection to the database. For more information, see How to: Connect to a Database with Server Explorer.

  2. In Server Explorer, find the name of the object to be debugged by opening the database node, and then the appropriate folder. Double-click the object's file name to load the code into the Transact-SQL editor.

  3. Right-click the object name, and on the shortcut menu, click Step into <object type> to step into the object with the debugger. Note: If the object is a trigger, you cannot step into it directly; instead, you must step into a stored procedure that can cause the trigger to fire.

  4. If the object requires parameters, a dialog box appears, with a table containing a row for each parameter. Each row in the table contains a column for the name of the parameter, and one for the value of that parameter. Enter values for each parameter, and click OK.

    The code for the object is displayed, with a yellow arrow in the left gray margin indicating the statement about to be executed. The instruction pointer will be on the first executable line of code in the object.

    You may now use most of the familiar debugger features. For more information see Transact-SQL Object Debugging Using the Locals and Watch Windows and Limitations on Debugger Commands and Features.

  5. To continue debugging, on the Debug menu, click Continue. The code executes up to the next breakpoint.

See Also

Other Resources

Common Procedure Reference (Debugging Transact-SQL)