Microsoft KB Archive/317241

= Renaming a host computer for SQL Server causes stored procedure debug to fail =

Article ID: 317241

Article Last Modified on 5/18/2007

-

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 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q317241



SYMPTOMS
If you rename the host computer for a Microsoft SQL Server 2000 server, you cannot step into a SQL Stored Procedure with the Visual Studio 2005 or Visual Studio .NET environment, and you may receive the following error message:

The thread 'OldServerName(nn)' (0x8nnnnnnn) has exited with code 0 (0x0). The program 'SQL Debugger: T-SQL' has exited with code 0 (0x0).

Note You can still run the stored procedure.



CAUSE
The Debugger cannot find the name of the host computer in the system table entry because the host computer has been renamed. During installation, SQL Server stores the name of the host computer in a system table entry that is used by the debugger. If the host computer is renamed, this table is not updated automatically.



RESOLUTION
Update the name of the SQL Server internal computer:   In Query Analyzer, run the following commands: sp_dropserver 'OldServerName' go sp_addserver 'NewServerName','local' go  Stop and restart SQL Server to update the global variable @@servername with the correct server name.  Use Query Analyzer and run the following command to verify the correct server name: SELECT @@servername 

