Change the SQL Server Name after Changing the Computer Name

Recently I changed the name of my SQL Server computer from the generic one given by the Windows installation to ‘SERVER’. In the beggining there was no apparent problem in the connections since I used IP addresses. After a while I wanted to use Replication and tried to create an SQL Server Publication only to find that the name of the SQL SERVER has not changed and I could not create a publication unless I connected with the correct computer name. It turns out that changing the computer name does not update the sql server name and you need to change it manually in order to be able to use replication or any other Sql Server feature that requires you to connect using the computer name!

Below is a simple code that you can use to change the name of the SQL Server.

sp_dropserver @@SERVERNAME
GO
sp_addserver 'newServerName', local
GO

You need to restart the SQL Server in order for the changes to take effect.

2 Comments

  1. 🙄

Leave a Reply

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