Saturday, July 4, 2009

Renaming a computer that hosts SQL Server

To rename a computer that hosts a stand-alone instance of SQL Server

For a renamed computer that hosts a default instance of SQL Server, run the following procedures:

sp_dropserver
GO
sp_addserver , local
GO

Restart the instance of SQL Server.

For a renamed computer that hosts a named instance of SQL Server, run the following procedures:

sp_dropserver
GO
sp_addserver , local
GO

Restart the instance of SQL Server.

After the Renaming Operation

After a computer has been renamed, any connections that used the old computer name must connect by using the new name.
To verify that the renaming operation has completed successfully

Select information from either @@SERVERNAME or sys.servers. The @@SERVERNAME function will return the new name, and the sys.servers table will show the new name. The following example shows the use of @@SERVERNAME.

SELECT @@SERVERNAME AS 'Server Name'

0 comments:

Post a Comment