Saturday, February 11, 2012

@@SERVERNAME returns NULL value... Can we adjust so that it returns the server name

We are running SQL 2000 in a non-clustered server. For some reason when we
select @.@.SERVERNAME we are getting a NULL value back. According to BOL ...
the information in returned by @.@.SERVERNAME may be different than the
SERVERNAME property of SERVERPROPERTY function. The SERVERNAME property
automatically reports changes in the network name of the computer. In
contrast, @.@.SERVERNAME does not report such changes. @.@.SERVERNAME reports
changes made to the local server name using the sp_addserver or
sp_dropserver stored procedure
Assuming that my server name is XYZ - I would assume that by executing the
following command we would be OK:
use master
go
sp_addserver 'XYZ', 'local'
go
But when executing this - we get the following message:
Server already exists.
Can someone advise the correct way to do this?
Thanks,
TomHi,
Try this
sp_dropserver 'XYZ'
go
sp_addserver 'XYZ', 'local'
go
After this stop and start the MS SQL Server service. Then login in Query
analyzer and execute SELECT @.@.SERVERNAME
Thanks
Hari
SQL Server MVP
"TJT" <TJT@.nospam.com> wrote in message
news:O9QwWELiFHA.1244@.TK2MSFTNGP14.phx.gbl...
> We are running SQL 2000 in a non-clustered server. For some reason when
> we
> select @.@.SERVERNAME we are getting a NULL value back. According to BOL
> ...
> the information in returned by @.@.SERVERNAME may be different than the
> SERVERNAME property of SERVERPROPERTY function. The SERVERNAME property
> automatically reports changes in the network name of the computer. In
> contrast, @.@.SERVERNAME does not report such changes. @.@.SERVERNAME reports
> changes made to the local server name using the sp_addserver or
> sp_dropserver stored procedure
> Assuming that my server name is XYZ - I would assume that by executing the
> following command we would be OK:
> use master
> go
> sp_addserver 'XYZ', 'local'
> go
> But when executing this - we get the following message:
> Server already exists.
> Can someone advise the correct way to do this?
> Thanks,
> Tom
>
>
>|||Hi Hari,
I have the same scenario as below, and I have even try to do two times
server restart also, but @.@.servername still returns Null to me, which is
different result from SERVERNAME property of SERVERPROPERTY function. Any
idea what else we can try? Thanks in advance!
Regards,
JC
"Hari Prasad" wrote:
> Hi,
> Try this
>
> sp_dropserver 'XYZ'
> go
> sp_addserver 'XYZ', 'local'
> go
> After this stop and start the MS SQL Server service. Then login in Query
> analyzer and execute SELECT @.@.SERVERNAME
> Thanks
> Hari
> SQL Server MVP
>
> "TJT" <TJT@.nospam.com> wrote in message
> news:O9QwWELiFHA.1244@.TK2MSFTNGP14.phx.gbl...
> > We are running SQL 2000 in a non-clustered server. For some reason when
> > we
> > select @.@.SERVERNAME we are getting a NULL value back. According to BOL
> > ...
> > the information in returned by @.@.SERVERNAME may be different than the
> > SERVERNAME property of SERVERPROPERTY function. The SERVERNAME property
> > automatically reports changes in the network name of the computer. In
> > contrast, @.@.SERVERNAME does not report such changes. @.@.SERVERNAME reports
> > changes made to the local server name using the sp_addserver or
> > sp_dropserver stored procedure
> >
> > Assuming that my server name is XYZ - I would assume that by executing the
> > following command we would be OK:
> >
> > use master
> > go
> >
> > sp_addserver 'XYZ', 'local'
> > go
> >
> > But when executing this - we get the following message:
> > Server already exists.
> >
> > Can someone advise the correct way to do this?
> >
> > Thanks,
> > Tom
> >
> >
> >
> >
> >
> >
>
>

No comments:

Post a Comment