ssb diagnose
#ssb-diagnose#how-to-debug-database-objects

How to: Debug Database Objects

09/10/2025 A SQL Server unit test consists: Unit test code written in C# or Visual Basic. This code, which is generated by the SQL Server Unit Test Designer, is responsible for submitting the Trans

A SQL Server unit test consists:

Unit test code written in C# or Visual Basic. This code, which is generated by the SQL

Server Unit Test Designer, is responsible for submitting the Transact-SQL script that forms

the body of the test.

One or more test conditions, which are written in C# or Visual Basic. To debug test

conditions, follow the procedure for debugging a unit test as described in

How to: Debug

while a Test Is Running (Visual Studio 2010)

or

How to: Debug while a Test Is Running

(Visual Studio 2012).

One or more Transact-SQL scripts that run on objects in the database that you’re testing.

You can’t debug these Transact-SQL scripts.

The procedures in this article describe how to debug particular database objects, such as

stored procedures, functions, and triggers in the database you’re testing. To debug a database

object, follow these procedures in this order:

  1. Enable SQL Server debugging on your test project.

  2. Enable application debugging on the SQL Server instance that hosts the database you’re

testing.

  1. Set breakpoints in the Transact-SQL script of the database objects you’re debugging.

  2. Debug your unit test. In this procedure, you run the test in debug mode.

  3. Open.

  4. In

, right-click the test project, and select.

A properties page that has the same name as the test project opens.

  1. On the properties page, select.

  2. Under

, select.

  1. Save your changes.