Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How do you fix the issue when SELECT @@SERVERNAME returns null


PS: I just figured this out but it wasn't obvious... Answer to follow

share|improve this question

1 Answer 1

up vote 3 down vote accepted
sp_dropserver 'OLDNAME'
sp_addServer 'NEWNAME', 'local'

The 'local' part is important, it doesn't work without it ( I think it attempts to add the server as a remote linked server without it)

share|improve this answer
Correct, without the 'local' it creates it as a remote server. –  mrdenny Sep 24 '09 at 21:04
Weirdly the documentation failed to mention it (grr) –  David Hayes Oct 22 '09 at 21:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.