Home > Archive > MS SQL Server > March 2006 > SELECT @@SERVERNAME









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SELECT @@SERVERNAME
Whispering Leaf

2006-03-08, 11:23 am

Why does this query return NULL?

It only happens on one of our SQL servers.


Thanks.
Francis

2006-03-08, 1:23 pm

It may have happened if the server was renamed.
Execute select serverproperty('serv
ername')

if this is different to @@servername you need to do the following:

EXEC sp_dropserver 'yourServerName'
EXEC sp_addserver 'yourServerName', 'local'

Stop SQL Server.
Restart SQL Server.





"Whispering Leaf" wrote:

> Why does this query return NULL?
>
> It only happens on one of our SQL servers.
>
>
> Thanks.

Thomas LaRock

2006-03-08, 8:23 pm

I have seen this when someone creates a linked server that has the same name
as the sql server.

if you look in the master..sysservers table, the row with a srvid = 0 should
be your servername.
--
Thomas LaRock
Database Administrator
ING Investment Management



"Whispering Leaf" wrote:

> Why does this query return NULL?
>
> It only happens on one of our SQL servers.
>
>
> Thanks.

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com