How to rename sql server when old name is not known

  • Hi Everyone,

    One of our old server is returning NULL for serverproperty('InstanceName'). I have used sp_addserver with new name and restarted the server but there is no effect. Can some one suggest how to change the name of the server when old name is not known.

    ta

  • For it to take effect, you have to set it with

    sp_addserver 'YourServername', 'LOCAL'

    and then restart the SQL Services

    (note: for some reason last time I had to do it, it only worked by using the uppercase LOCAL)

    did you do the sp_dropserver before as well?

    _______________________________________________________________________
    For better assistance in answering your questions, click here[/url]

  • Try Select @@Servername

    That *should* give you the server name, SELECT serverproperty('InstanceName') gives me null on a couple of machines.

  • Ronnie, you are correct... forgot about @@servername....

    _______________________________________________________________________
    For better assistance in answering your questions, click here[/url]

  • Hi Ronnie,

    @@servername also returned NULL. I have used addserver with out 'Local' option. Will try that and will update the post accordingly.

  • Try SERVERPROPERTY('ServerName'). See BOL ---> SERVERPROPERTY for the possible output.

    SERVERPROPERTY('InstanceName') may also return NULL if you work on the default instance (besides invalid input, etc). But I think that you're using the wrong function...

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply