SqlShare.com Logo
 
Skip Navigation Links
Home
Video List
Events
Classes
About Us
Login / Register
Subscribe RSS Feed 

Confio Ignite 8

Using @@ServerName and ServerProperty

@@Servername is the tried and true method of getting the name of the server, quick and easy to use. But did you know it might not return what you expect? Watch the video to see how to use @@servername and ServerProperty() so that you know the deal!

Duration:
1 mins 33 secs
Skill Level:
100
Rating:
4.29 out of 5
Publish Date:
February 18, 2010
Using @@ServerName and ServerProperty You must be logged in to view this video.  
Bookmark and Share
 
1=Poor, 3=Good, 5=Excellent

About the Author

Image of Andy Warren
Andy Warren is a software trainer focusing on SQL Server, a member of the PASS Board of Directors, and a principal in this site - SQLShare.com.

References

There are no downloads or recommended reading links for this video

Comments
Sandip on 2/18/2010
Good to know

Sandip on 2/18/2010
I tried serverproperty function for my local machin and its giving me result NULL?

Shimple and besht, Ke@p tit tup.

01EFFB45CF on 2/18/2010
Good to know. I want the absolute most reliable way and will use this approach.

Matt Karp on 2/18/2010
Good little bit of info about the rename

Andrew Meyer on 2/18/2010
Wouldn't the 'ServerName' property of the serverproperty function be more equivalent to @@ServerName? Or does this suffer the same problem on a server rename? Or was the initial objective to get the actual server name, not the instance name?

Mention of InstanceName would have completed the concept.

Kevin on 2/18/2010
Excellent, as always.

2E6B6238AA on 2/18/2010
I also tried the serverproperty function on all my 2005 SQL Server boxes and they are all returning NULL?

Martin Miller on 2/18/2010
Thanks Andy. -Martin

Deepak Kolapkar on 2/18/2010
Real good... really refreshes the basics

Paradoxical on 2/18/2010
Excellent quality...

Mike on 2/18/2010
i like a very short video mixed in every few days.

ravi on 2/18/2010
Information is great

This was a small but very important piece of information. Thanks

Serghei on 2/19/2010
that's fine

Linda Wenglikowski on 2/19/2010
MachineName won't return your Cluster name.

Good video

Rick on 5/14/2010
One thing you should note is that the @@ServerName will return the MachineName and the instance. SELECT SERVERPROPERTY('ServerName'); might be a little closer to @@SERVERNAME. Rick



Must Be Logged In
 

How Do I Become a Video Author? |  Newsletter History

Copyright © Fourdeuce, Inc., 2005-2009. All Rights Reserved | Privacy Policy | Terms & Conditions