Debugging Database Objects That Use Managed Code (SQL Server CLR Integration Debugging)
This topic applies to:
Edition |
Visual Basic |
C# |
C++ |
Web Developer |
---|---|---|---|---|
Express |
||||
Standard |
||||
Pro and Team |
Table legend:
Applies |
|
Does not apply |
|
Command or commands hidden by default. |
This section contains samples for all SQL Server Common Language Run-time (SQL CLR) database object types.
There are three different scenarios to consider:
Stepping into a SQL Server 2005 database object by using Server Explorer. For more information, see How to: Step into an Object Using Server Explorer.
Running a test script using a Visual Studio 2005 SQL Server project.
Running an application that calls a stored procedure. For more information, see How to: Debug a SQL Server CLR Integration Stored Procedure.
To debug a trigger, you must start your debugging session in a stored procedure. In particular, you cannot debug a stand-alone Transact-SQL script, nor can you debug a trigger by causing it to fire by invoking a script.
Database Tier Software Requirements
SQL CLR debugging requires the following additional software on the server:
- The Remote Debugging Monitor (msvsmon) must be running when you debug. If you are running SQL Server 2005, the Setup program to install msvsmon is already on the server, in <sql server install dir>\90\Shared\rdbgsetup.exe. Run this program to install it, and SQL Server will launch it whenever you step into or hit a breakpoint.
Troubleshooting Issues with SQL CLR Debugging
If, when you try to debug a SQL CLR object, the message "Canceled by user" appears, you must manually configure both the computer on which you are running Visual Studio as well as the computer that is running SQL Server. For more information, see How to: Configure Your Computers to Enable Transact-SQL and SQL Server CLR Integration Debugging.
Common Tasks
Common Tasks |
Supporting Content |
---|---|
Learn more about SQL CLR database projects: Read about advantages of developing.NET Framework database objects for SQL Server by using managed code. Managed code has several advantages compared with Transact-SQL. |
|
Perform necessary setup before you debug: There are steps that you must take to enable SQL CLR debugging. In addition, you can find information about some common problems and how to resolve them. |
|
Debug different types of SQL CLR objects: Follow the corresponding procedure to learn how to debug stored procedures, triggers, user-defined scalar functions, user-defined table-valued functions, user-defined aggregates, and user-defined types that were created by using managed code. |
|
Upgrading SQL Server Versions after Setting up SQL Debugging
If you install a new version of after you complete the setup, you must rerun the Remote Components Setup to make sure that you have the correct components installed for remote debugging. For more information, see How to: Set Up Remote Debugging and [Obsolete] Remote Debugging Components.
SQL Can't Find SSDEBUGPS
When you try to start SQL debugging, you might receive the following error message: SQL Can't Find SSDEBUGPS.
To resolve this issue, you must rerun Remote Debugging Components. For more information, see How to: Set Up Remote Debugging.
Unable to attach to the crashing process. The specified program is not a Windows or MS-DOS program.
The following error message might appear when you try to debug a SQL CLR object: Unable to attach to the crashing process. The specified program is not a Windows or MS-DOS program.
This error occurs when you manually launch the Remote Debugging Monitor (msvsmon) with SQL Server configured to run as an account other than LocalSystem or the user who is logged in.
To correct this error, you must allow SQL Server to auto-launch the Remote Debugging Monitor instead of launching it manually.
Related Topics
Title |
Description |
---|---|
Debugging Transact-SQL (Microsoft Web site) |
Describes how to debug database objects such as stored procedures, functions, and triggers. |