Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 @@Servername = NULL

Author  Topic 

jbkayne
Posting Yak Master

100 Posts

Posted - 2003-04-24 : 13:42:46
As of yesterday,

select @@servername

returns NULL

on one of our SQL Server 2000 boxes. I know that someone in the organization altered NT Permissions on this machine. Can anyone offer advice on how to fix this?




tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-04-24 : 13:50:27
That's unusual. What does this return: select * from master.dbo.sysservers where srvid = 0? Do you get an error when running this query? If so, what is the error?

SELECT @@SERVERNAME should be equivalent to the above query.

Tara
Go to Top of Page

jbkayne
Posting Yak Master

100 Posts

Posted - 2003-04-24 : 13:53:06
quote:
Do you get an error when running this query? If so, what is the error?




I ran:
select * from master.dbo.sysservers where srvid = 0

it didn't return an error... just:
(0 row(s) affected)

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-04-24 : 13:58:58
Hmmm, I would run sp_addserver then to fix your problem.

Example of sp_addserver (please see BOL for syntax):
sp_addserver @server = 'server', @local = 'local'

I doubt that permissions caused this problem though since the record doesn't even exist in sysservers. I would think that they only way for the record to not exist in sysservers would be to run sp_dropserver or DELETE FROM sysservers (with allow updates to system tables turned on).


Tara
Go to Top of Page

jbkayne
Posting Yak Master

100 Posts

Posted - 2003-04-30 : 19:21:20
Thanks for all your help... This problem still hasn't gone away.

Here is some more information:

I ran:
sp_addserver.
I ran:
select * from master.dbo.sysservers where srvid = 0

i see the server now...

I ran:
select @@servername

it returns NULL.



--- I don't get it.


Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-04-30 : 19:34:49
I don't get it either.

If this is functionality that you need, then you are probably going to have to contact MS for a fix because I just can't think what could be the problem (except what I have already mentioned).

Tara
Go to Top of Page

jbkayne
Posting Yak Master

100 Posts

Posted - 2003-04-30 : 19:57:31
I cycled SQL Server again, and this time it worked.

It must cache the servername.....

Thanks again everyone!


Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-05-01 : 07:14:53
http://support.microsoft.com/default.aspx?scid=kb;en-us;303774

Jay White
{0}
Go to Top of Page
   

- Advertisement -