Skip to content

Rename a SQL Server Instance

A short script showing how to rename a SQL Server instance's registered name and verify it.

Published Dec 1, 2010

Renaming a SQL Server instance means updating the server registration so that local connections resolve to the new name. This short script shows the two-step process - sp_dropserver for the old name, then sp_addserver with the local flag for the new one - followed by the queries you use to verify what the server thinks its own name is.


--EXEC sp_dropserver P2PPRODDB01
GO

--EXEC sp_addserver P2PPRODTESTDB01, local 
GO


select * from sys.servers

select SERVERPROPERTY('servername')
select @@servername
select HOST_NAME()
An unhandled error has occurred. Reload 🗙