Tuesday, June 16, 2009

Alter SQL Server Internal Name

SQL server maintains the local server name with the master database. The current server name can be identified by running the query:

USE master;
GO
Select * from sysservers;
GO

The srvname in the output reflects what SQL thinks the server name is. When altering a server's NetBIOS name that is running SQL, the srvname field needs to be updated. To achieve this execute the following query:

EXEC sp_dropserver 'oldname';
GO
EXEC sp_addserver 'newname', 'LOCAL';
GO

Where oldname is the server's original NetBIOS name, newname is the new NetBIOS name and LOCAL specifies that the server is a local (not remote) server.

No comments: