How to: Step into an Object Using Server Explorer

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic does not apply Topic does not apply Topic does not apply Topic does not apply

Standard

Topic does not apply Topic does not apply Topic does not apply Topic does not apply

Pro and Team

Topic applies Topic applies Topic applies Topic applies

Table legend:

Topic applies

Applies

Topic does not apply

Does not apply

Topic applies but command hidden by default

Command or commands hidden by default.

The following procedure describes how to debug a database object by stepping into it with the Visual Studio Server Explorer. This method of 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 Visual Studio, if you have not already done so, establish a connection to the database. For more information, see How to: Connect to a Database.

  2. If the object is written in C# or Visual Basic, verify SQL CLR debugging is enabled for the connection. For more information, see How to: Enable CLR Debugging For a Connection.

  3. 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 Text Editor.

  4. Right-click the object name, and on the shortcut menu, click Step into <object type> to step into the object with the debugger.

    1. 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.
  5. 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 SQL Object Debugging Using the Locals and Watch Windows and Limitations on Debugger Commands and Features.

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

See Also

Other Resources

Common Procedure Reference