Changing @@servername

  • Hi,

    I recently installed sql server on a machine, which had a name change. I am not sure sql was installed before the name was changed.  Now, everything except @@servername is reflecting the new name. It is a default instance, so it is registered as local.  isql works fine with the new name.

    The @@server and master..sysservers are having the old name.  Now this is a production box, and I cannot do all the experiments.  Can someone suggest me, exactly what I need to do to change it?   Do I have to uninstall sql tools and reinstall on this machine ?  Will I have to use:

    sp_dropserver <oldname>

    sp_addserver<newname>  If I issues these commands, will i have a downtime of the instance ?  Or will it force me for a reboot ?  Thanks much for your help.

    Bill

  • To update the sysservers table you have to run:

    sp_dropserver old_name

    GO

    sp_addserver new_name, local

    GO

    This immediately changes the value in the sysservers table.

    For the variable @@SERVERNAME to reflect the change, you have to restart SQL.

Viewing 2 posts - 1 through 1 (of 1 total)

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