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'
go

sp_addserver 'newHostname',local
go

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

select @@servername as 'Server Name'

or

select * from sys.servers

No comments: