Problem after changing PC name

  • Dear All,

    One of our client changed machine name after installing SQL Server.I was able to login to SQL server as usual and SQL servername (same as machine name)was displayed in the object explorer as well.I created a DSN and even that was connecting without any problem.

    Problem happend when I executed one of my ASP file, which inserts data into a table using the above mentioned DSN. Got error saying "Could not fine "SERVER NAME" in sys.servers.

    When I query "Select @@servername" I got someother name (must be the OLD machine name).But in object explorer it was showing differently. Why so.?

    How was I able to login with the server name which was not there in "sys.servers".?

    Thanks.

  • you login using your old server name OR new server name? OR local host (.)

    and which mode you using for login SA/windows?

  • Hi,

    Whenever a system in renamed at the o/s it has to be renamed at the sql server level also. Try following steps. Login into the sql server system and try this.

    If it is a default instance

    sp_dropserver

    GO

    sp_addserver , local

    GO

    If it is a named instance

    sp_dropserver

    GO

    sp_addserver , local

    GO

    and restart the sql server services and check out

    SELECT @@SERVERNAME AS 'Server Name'

    [font="Verdana"]Thanks
    Chandra Mohan[/font]

  • you was able to login because, you must be having alias created using your server IP and old server name.

    If you remove that alias then you wont be able to login using your old server name.

    check this.

  • @chandu, I'm pretty sure the code will throw an error message.

    From BOL syntax for dropserver: sp_dropserver [ @server = ] 'server'

    [ , [ @droplogins = ] { 'droplogins' | NULL} ]

    It looks like you need to use old server name.

    @OP:

    select @@servername will show you current server name, copy that and replace 'server' in the following with the output:

    sp_dropserver 'old_server'

    GO

    sp_addserver 'new_server', local

    GO

    exec sp_helpserver

  • Hi Binko,

    Thanks for the correction. I had missed the servername in dropserver.

    [font="Verdana"]Thanks
    Chandra Mohan[/font]

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

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