Skip to content

Different Types of SQL Server Debugging Through IDE

August 11, 2009

Different Types of SQL Server Debugging:

For Microsoft SQL Server 2005, all database debugging occurs from within the Visual Studio IDE. Database objects like stored procedures, triggers, and User-Defined Functions (UDFs) can be debugged. Visual Studio offers three ways to debug these database objects

ᅢリ           Direct Database Debugging

ᅢリ       Application Debugging

ᅢリ          Debugging from a SQL Server Project

Direct Database Debugging (DDD):

1.      Open Server Explorer and add a Data Connection to a SQL Server database.

2.    Then browse to any object in the database, such as a stored procedure or function.

3.    Right click on it, and select Step Into to begin DDD.

Application Debugging:

1.      Visual Studio can be used to attach to any client application that opens a database connection to SQL Server, e.g. SQL Management Studio, and then debug code executed on this connection.

2.    When client process is attached, make sure the debugging type includes T-SQL code, along with any other desired types such as native code and/or managed code.

There are some notable limitations in application debugging:

1.      Client process to be attached before the database connection is opened.  Any code run on the connections opened before attaching will be ignored.

2.      A Data Connection to the server being debugged must present in the Server Explorer.  Connections made by the attached client to databases not listed in Data Connections in Server Explorer will not be debugged.

3.      We can not step into a store procedure from client code (managed or native).  Usually we need to set a breakpoint in the code that you want to debug.  To do this browse to the desired object in Server Explorer, double click on the object to open its source code, and set a breakpoint.

Debugging from a SQL Server Project:

Visual Studio offers a SQL Server Project type. This project can include both T-SQL and managed database objects and these objects can be debugged by debugging the SQL Server Project itself.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: