Wednesday, February 23, 2011

Rename servername in MS-SQL when computer hostname changes.

When you change computer hostname, MS-SQL servername is not automatically updated. In order to update MS-SQL servername I used following SQL commands

sp_dropserver 'oldHostname'

sp_addserver 'newHostname',local

Now restart your SQL server instance and when follwing command is executed, you will see newHostname appears.

select @@servername as 'Server Name'


select * from sys.servers

No comments: