Subscribe

SQLServer-DBA.com Links

Subscribe to newsletter

Dba_db2_button

Powered by TypePad
SQL Server – Change @@servername - sp_dropserver and sp_addserver

22 November,2012 by Jack Vamvas

Sometimes a server name needs to change . In those situations you need  make a change in SQL Server allowing SQL Server to use the latest name . 

Follow these steps to change the server name in SQL Server

Step 1- Check the current name by :

 

SELECT @@SERVERNAME  AS pre_change_name,       Serverproperty('Servername') AS current_server_name

If the two values are different use this procedure  to update the name

 

Step 2 – use sp_dropserver and sp_addserver

 

EXEC sp_dropserver 'OLD_SERVER_NAME\MYINST1'
EXEC sp_addserver 'NEW_SERVER_NAME\MYINST1', 'local'

select @@servername 	
---Should now display the correct name 

 

Step 3  - Restart the service

 

NET STOP MSSQL$MYINST1
NET START MSSQL$MYINST1

 Read More

How to check Operating System type with Powershell

SQL Server Version with Powershell


Author: Jack Vamvas (http://www.sqlserver-dba.com)

******** *******

Subscribe to SQLServer-DBA.com

Latest posts delivered to you daily

Delivered by FeedBurner

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer