Microsoft KB Archive/817253

= Cannot debug a stored procedure in Visual Studio 2005 or in Visual Studio .NET after you rename SQL Server =

Article ID: 817253

Article Last Modified on 2/24/2006

-

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
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition

-



SYMPTOMS
When you rename your installation running Microsoft SQL Server a different name from your host server, you cannot step into the SQL stored procedure to debug in the Visual Studio 2005 or Visual Studio .NET development environment. T-SQL debugger silently executes the stored procedure and then does not stop at the breakpoint in the stored procedure.



CAUSE
During installation, SQL Server stores the server name in a system table entry that the debugger uses. When you modify the SQL Server name, the system table entry updates the server name. For T-SQL debugging to work correctly in Visual Studio 2005 or in Visual Studio .NET, the computer name and the SQL Server installation name must match. If you rename the SQL Server installation, the computer names do not match the SQL Server installation name, and then T-SQL debugging fails.



STATUS
This behavior is by design.



Steps to Reproduce the Behavior
 Verify that T-SQL debugging works in Visual Studio 2005 or in Visual Studio .NET.  Run the following command in Query Analyzer to rename your SQL Server: sp_dropserver 'OldServerName' go sp_addserver 'NewServerName','local' go  Stop and then restart SQL Server to update the @@servername global variable with the correct server name.  To verify that the server name is modified, use Query Analyzer to run the following command: SELECT @@servername  Delete and then re-create your data connection in Server Explorer. Open the stored procedure in Server Explorer, and then set a breakpoint.</li> When you try to step into the stored procedure, notice that T-SQL debugger ignores the breakpoint that you set.</li></ol>

<div class="references_section">