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

Renaming Server with SQL

I recently had to rename my laptop on which I have two SQL server instances.  I have a default instance and a named instance.  I actually have had the laptop renamed for awhile without any issues, but it’s not production and I don’t use it every day.  I first encountered the error while creating a schedule for a new SQL Agent job.  The error I received said that the server could not be found and provided the server name that it could not connect to.  I immediately noticed that it showed the previous machine name.  If you run into this error, then you need to update the sever name in sys.servers.  Here is how to make the update.

Default Instance

sp_dropserver 'PreviousName'
sp_addserver 'NewName', local

Named Instance

sp_dropserver 'PreviousNameInstanceName'
sp_addserver 'NewNameInstanceName', local

Now that sys.servers has been updated you need to restart SQL server for the changes to take effect.  Once SQL comes back up, you can verify success by running the following and ensuring the results match your new server name.


Ryan Adams

Ryan Adams has worked for Verizon for 15 years. His primary focus is the SQL Server Engine, high availability, and disaster recovery. Previously he was a Senior Active Directory Architect and designed the company's worldwide Active Directory infrastructure. He serves on the Board of Directors for the North Texas SQL Server User Group and is President of the PASS Performance Virtual Chapter. He also serves as a Regional Mentor for PASS and holds the following certifications: MCP MCSA MCSE MCDBA MCTS MCITP.


Leave a comment on the original post [www.ryanjadams.com, opens in a new window]

Loading comments...