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 :
- Out the AD server
- Rename the server
- Integrate the server with your AD
- 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.