@@servername

  • Hi,

     When I use the @@servername, I am getting null as result. Do you have any idea why this is happening.

  • Did you run sp_dropserver?

    Did you restart the service/server?

  • No, I did not run that SP but when I tried to use the sp_addserver, it says server already exists in that name.

  • That can't be good, can you restart the service (and the server if that doesn't work)?

  • I'd take Remi's advice and drop the server, then add it back in:

    EXEC sp_dropserver 'yourServerName'

    EXEC sp_addserver 'yourServerName', 'local'

    Stop SQL Server.

    Restart SQL Server.

    Also, try either or both of these:

    EXEC sp_helpserver

    and

    SELECT srvid

         , srvname

         , datasource

         , srvnetname

     FROM master..sysservers

    Do the results look correct?

     

     

  • Works great thanks.

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

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