ServerName

  • I cannot see my servername?? What should I do to add my servername into table.

    when I do select * from sysservers I get blank rows???

     

  • What does this return?

    Select @@ServerName

  • I get NULL

  • If it's returning NULL, you will probably have to use the sp_dropserver, and sp_addserver stored procedures to get the name back.  Do this from the Master database.  You're not really dropping the whole server, just the internal name.  Was this server renamed at some point in the past? 

     

    My hovercraft is full of eels.

  • when you add the server remember to use the local paramater

    sp_addserver 'yourserver', 'local'

    without this you simply add a new server and you will still get null from @@servername, also is requires a sql service restart

  • Thanks for the feedback

    1. One quick question how should I drop the servername if there in NULL value.

    Can I do sp_dropserver 'NULL'

    sp_addserver 'Local' ( shall I use the Local or the Windows server name)

    If I do, do i need to restart the server or shall my jobs and DTS will be fine.

     

     

    2. I don't know in the past if they have rename the server, if that the case what should I do???

  • If you query sysservers you should see an entry for your server, but it probably does not have a svrid of 0 so it wont show up as local server

     

    if you run this code replacing yourserver with the actual name of your server and restart the sql service it should then be fine

     

    sp_dropserver 'yourserver'

    go

    sp_addserver 'yourserver', 'local'

  • You don't need the sp_dropserver if there are no rows in sysservers.

    Basically, it's one half of "renaming a server" in BOL

  • DOn't forget to stop/restart SQL Server ... @@servername is set on starting the server.

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

  • Hehe... that's a nice gotcha!!

    How much time did you lose on this one?

  • none ... figured it out in v4.21a ... it's been the same ever since !

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

Viewing 11 posts - 1 through 10 (of 10 total)

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