Microsoft KB Archive/317241

From BetaArchive Wiki
Knowledge Base


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:

  1. In Query Analyzer, run the following commands:

    sp_dropserver 'OldServerName'
    go
    sp_addserver 'NewServerName','local'
    go
                        
  2. Stop and restart SQL Server to update the global variable @@servername with the correct server name.
  3. Use Query Analyzer and run the following command to verify the correct server name:

    SELECT @@servername
                        


REFERENCES

For more information about how to set up SQL debugging, see the following topic in the Visual Studio .NET online Help documentation:



For more information about renaming a SQL Server, see "Renaming a Server" in SQL Server Books online. In addition, click the following article number to view the article in the Microsoft Knowledge Base:

303774 BUG: Renaming a Server Topic in Books Online is Incomplete


Keywords: kbvs2005applies kbvs2005swept kbvs2002sp1sweep kbbug kbdebug kbprb KB317241