November 30, 2004 at 10:17 am
Hi,
MSSQL 2000/sp3; using Query Analyzer ...
Any ideas why <SELECT @@servername> returns NULL and what are the steps to ensure that it picks up the server name?
Many thanks. Jeff
November 30, 2004 at 12:01 pm
Try SP_Addserver newname, 'local'
You have to stop / star SQL for it to take affect
KlK
November 30, 2004 at 12:50 pm
Also, if you are using sql 2000 try
cast(serverproperty('servername') as varchar(256))
should return the name even if @@servername returns null
November 30, 2004 at 1:08 pm
Hi Wesley, this method does work! Any idea why the @@servername returns NULL and this method doesn't?
Many thanks. Jeff
November 30, 2004 at 3:01 pm
It looks in a diffrent location for the server name @@SERVERNAME was used from 7.0 and back and has to have an entry in the sysservers table to work. that is what the sp_addserver does.
Wes
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply