Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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.