@@ServerName return NULL | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

@@ServerName return NULL

Hi,
I am facing a strange issue. I have a SQL server named ABC02 which is replacement server of ABC01. In order to preserve the name i want to change the name of ABC02 to ABC01 while i do the replcement. To accomplish that i used sp_addServer and sp_DropServer. When i checked sysservers the servername shows ABC01 now. when i execute ServerProperty (‘ServerName’) it returns ABC01 now but when i execute Select @@ServerName it returns NULL. Select @@ServerName was returning ABC02 before. I did restarted the SQL Server and machine as well still @@ServerName returns NULL.
Any idea. Jigar Patel
Kindly don´t duplicate post. Luis Martin
Moderator
SQL-Server-Performance.com One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important
Bertrand Russell
All postings are provided “AS IS” with no warranties for accuracy.
Try:
Use Master
go
Select @@Servername This should return your current server name but if it
returns NULL then try: Use Master
go
Sp_DropServer ‘OldName’
GO
Use Master
go
Sp_Addserver ‘NewName’, ‘local’
GO
Stop and Start SQL Services

Hai ,this is srinivas. i have some doubts about PL/SQL. how to remove the Duplicate rows from table ?
write query for start with name s and end with s??
how to find highest and lowest sal of emp ?? send querys for above?? regards,
srinivas
quote:Originally posted by srinii Hai ,this is srinivas. i have some doubts about PL/SQL. how to remove the Duplicate rows from table ?
write query for start with name s and end with s??
how to find highest and lowest sal of emp ?? send querys for above?? regards,
srinivas

Hi Srinivas,
refer this link for all these type of interview questions.
http://vyaskn.tripod.com/iq.htm[:)]
Search in this Forum and you will find answers
All the best for Interviews Madhivanan Failing to plan is Planning to fail
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by srinii</i><br /><br />Hai ,this is srinivas. i have some doubts about PL/SQL.<br /><br />how to remove the Duplicate rows from table ?<br />write query for start with name s and end with s??<br />how to find highest and lowest sal of emp ??<br /><br />send querys for above??<br /><br />regards,<br />srinivas<br /><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">And perhaps search in Oracle resources for PL/SQL questions.[<img src=’/community/emoticons/emotion-5.gif’ alt=’;)‘ />]<br /><br />And perhaps start a new thread instead of adding to an old, unrelated thread.[<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]
]]>