[TIPS] – SQL Server: how to rename the @@SERVERNAME of your SQL instance

0
267

Little “tips” to end the day, we will see how to rename the variable @@SERVERNAME of your SQL instance. If like me, once your SQL Server deployed, optimized as it should and ready to do battle with your developers, you notice that the server name does not match the “naming Charter” business…

You have two choices, first you can decide to format everything and start from scratch, or you can change the names properly 🙂

Yes, it is possible to rename it once SQL Server installed :

  1. Out the AD server
  2. Rename the server
  3. Integrate the server with your AD
  4. Follow the procedure below for SQL

Since SSMS, run the following query to check the value of @@SERVERNAME:

SELECT @@SERVERNAME AS 'Server Name';

Then enter the following commands:

sp_dropserver<OLD_SERVERNAME></OLD_SERVERNAME>
GO
sp_addserver <NEW_SERVERNAME>, local;</NEW_SERVERNAME>
GO

 

Restart the SQL  instance from SSMS (right click on the instance and then restart) and control by typing the first command again.

If all goes well your SQL instance has now the good server name.

JL
Fondateur de sys-Advisor.com, Passionné avant tout, je partage mon quotidien à travers ce site. #sysadmin #microsoft #vmware #tech #geek @sysadvisor

LAISSER UN COMMENTAIRE

Please enter your comment!
Please enter your name here