Solved

SERVERPROPERTY('SERVERNAME') & @@SERVERNAME

Posted on 2010-08-23
14
951 Views
Last Modified: 2012-05-10
Even though both these come from the SQL installation, they are different. How could that have happened?

Are they looking at 2 diff source, even though they are derived from the installation?

Thanks
0
Comment
Question by:anushahanna
  • 7
  • 3
  • 2
  • +1
14 Comments
 
LVL 60

Expert Comment

by:chapmandew
Comment Utility
you're getting 2 different values?  what are you getting?
0
 
LVL 29

Accepted Solution

by:
Rich Weissler earned 400 total points
Comment Utility
From the BoL:
"Although the @@SERVERNAME function and the SERVERNAME property of SERVERPROPERTY function may return strings with similar formats, the information can be different. 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."
0
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
select SERVERPROPERTY('SERVERNAME') is JMRW185422
select @@SERVERNAME is CO6849B546
0
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
select SERVERPROPERTY('SERVERNAME')  corresponds correctly to the machine name and the default instance also.
0
 
LVL 60

Expert Comment

by:chapmandew
Comment Utility
renamed the server recently?
0
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
renamed the server recently?

no.. just seen it lately.. so no workable issues with it...
0
 
LVL 11

Expert Comment

by:mattibutt
Comment Utility
Have you changed computer name after the install
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 6

Author Comment

by:anushahanna
Comment Utility
I had not; at least after SQL install, computer name was not changed.
0
 
LVL 11

Assisted Solution

by:mattibutt
mattibutt earned 100 total points
Comment Utility
Try to reinstall sql server
0
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
just to change @@SERVERNAME?
0
 
LVL 29

Expert Comment

by:Rich Weissler
Comment Utility
*confused*  Sorry, didn't realize this was still under discussion:

What happens if you execute:
sp_addserver 'local'
and then compare?
0
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
Thanks Razmus,
just to confirm

with the current state being:
select SERVERPROPERTY('SERVERNAME') is JMRW185422
select @@SERVERNAME is CO6849B546

you recommend the foll:
sp_addserver 'local'
to see if the 2 results will sync up?
0
 
LVL 29

Assisted Solution

by:Rich Weissler
Rich Weissler earned 400 total points
Comment Utility
Yes.
 That's based upon: http://msdn.microsoft.com/en-us/library/ms174411.aspx
"Specifying @local as LOCAL defines @server as the name of the local server and causes the @@SERVERNAME function to return the value of server. "
0
 
LVL 6

Author Comment

by:anushahanna
Comment Utility
I ran sp_addserver 'local'

still
select SERVERPROPERTY('SERVERNAME') is JMRW185422
select @@SERVERNAME is CO6849B546

should i restart the services?
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now