Rename a computer that hosts a stand alone instance of SQL Server

After changing a computer name, how do you reset the computer name in SQL server so that its name matches the computer name

When you change the name of the computer that is running SQL Server, the new name is recognized during SQL Server startup. You do not have to run Setup again to reset the computer name. Instead, use the following steps to update system metadata that is stored in sys.servers and reported by the system function @@SERVERNAME. Update system metadata to reflect computer name changes for remote connections and applications that use @@SERVERNAME, or that query the server name from sys.servers.

The following steps cannot be used to rename an instance of SQL Server. They can be used only to rename the part of the instance name that corresponds to the computer name. For example, you can change a computer named MB1 that hosts an instance of SQL Server named Instance1 to another name, such as MB2. However, the instance part of the name, Instance1, will remain unchanged. In this example, the \\ComputerName\InstanceName would be changed from \\MB1\Instance1 to \\MB2\Instance1.

sp_dropserver <old_name>;
sp_addserver <new_name>, local;

Restart the instance of SQL Server.

About Vincent Stefanetti

Vincent Stefanetti Senior Consultant MAX Manufacturing Software Working with MAX and Related Technologies Since 1987 MAX ERP System Implementations and Projects MAX, Dynamics GP, Synergy, Event Manager, Crystal Reports, SQL Reporting Services, Database and System Migrations and Updates, MAX Training Classes - All Levels, Custom Reporting.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *