SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

How to Change the SQL Server Name after Renaming the Windows Host

By Shashank Srivastava,

When we change the name of the windows machine on whom the SQL Server is running, the SQL server name does not reflect this change. We need to manually add the new server name and remove the old server name.


We have changed the windows machine name from Ahsi-PC to Shashank but when we look for the SQL Server name it will give the old windows machine name. You can see this in the image below. The new name is listed in Object Exporer, but the old name appears on the right as the result of the query.

To correct this, we need to first run sp_dropserver 'Old server Name' in the master database.

Next, we run sp_addserver 'New server name','local' in the master database. After running this, restart the SQL Server services.

Now check the new name of the instance by running select @@servername.

The SQL instance name has been changed and matches the windows name change.

The minimum rights required to perform this action are in the setupadmin server role.

Total article views: 7003 | Views in the last 30 days: -1
Related Articles

How to change Windows Authentication to Sql Server Authentication

How to change Windows Authentication to Sql Server Authenticati


Machine Name Change

If machine name changes will database keep working


SQL Server 2005 Ghost in the Machine

Administration, Setup, Server Change


Changed my app connection string from windows to SQL Server authentication

Changed my app connection string from Windows to SQL Server authentication


Connecting Windows Server 2003 VM To External Network In Hyper-V

The Windows 8 and Windows Server 2012 SP1 Virtual Machines on my laptop are connecting just fine to ...