You receive a "Cannot debug stored procedures" error message when you try to debug a SQL Server stored procedure in Visual Studio 2005 or in Visual Studio .NET (836734)



The information in this article applies to:

  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio .NET (2003), Professional Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition
  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition, when used with:
    • the operating system: Microsoft Windows Server 2003, Enterprise Edition
  • Microsoft Visual Basic 2005

SYMPTOMS

You use Microsoft Windows Terminal Services to log on as a non-administrator to a computer that is running Microsoft Windows Server 2003. In the Windows Terminal Services session, when you use Microsoft Visual Studio 2005 or Microsoft Visual Studio .NET to try to debug a Microsoft SQL Server stored procedure that is on a remote computer, you may receive the following error message:
Cannot debug stored procedures because the SQL Server database is not setup correctly or user does not have permission to execute master.sp_sdidebug. Run SQL Server setup or contact database administrator.

WORKAROUND

To work around this problem, assign the SeCreateGlobalPrivelege user right to the Windows Server 2003 user account that you want to use to perform SQL debugging. To assign the SeCreateGlobalPrivelege user right to the user account, add the user account to the security setting for the Create global objects policy. To do this, follow these steps:
  1. Make sure that the user account is a member of the following groups:
    • Users
    • Remote Desktop Users
    • Debugger Users
    • VS Developers
  2. Add the user account to the security setting for the Create global objects policy. To do this, follow these steps:
    1. Click Start, point to Administrative Tools, and then click Local Security Policy.
    2. In the left pane of the Local Security Settings console, expand Local Policies, and then click User Rights Assignment.
    3. In the right pane of the Local Security Settings console, right-click Create global objects, and then click Properties. The Create global objects Properties dialog box appears.
    4. Click Add User or Group. The Select Users or Groups dialog box appears.
    5. In the Enter the object names to select box, type the name of the user account, and then click OK.
    6. In the Create global objects Properties dialog box, click OK.
    7. On the File menu of the Local Security Settings console, click Exit.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to reproduce the behavior

  1. Use Windows Terminal Services to log on as a non-administrator to a computer that is running Windows Server 2003.
  2. Start Visual Studio 2005 or Visual Studio .NET.
  3. Make sure that an instance of SQL Server is running on a remote computer.
  4. In Visual Studio 2005 or in Visual Studio .NET, try to debug a SQL Server stored procedure that is on the remote computer.

REFERENCES

For more information, visit the following Microsoft Developer Network (MSDN) Web sites: For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

316549 How to debug stored procedures in Visual Studio .NET

815116 You cannot debug a SQL Server stored procedure in Visual Studio .NET

316569 FIX: Cannot step into stored procedure from ASP.NET code on Windows Server 2003

817178 Troubleshooting tips for T-SQL Debugger in Visual Studio .NET


Modification Type:MinorLast Reviewed:10/3/2006
Keywords:kbvs2005swept kbvs2005applies kbSysSettings kbSecurity kbpolicy kbUser kbTSQL kbTermServ kbStoredProc kberrmsg kbDebug kbinterop kbprb KB836734 kbAudDeveloper