Ed Wagner (10/23/2014)
You could also use the built-in function @@servername to return the same thing.
SELECT @@SERVERNAME;
This only works if the server is configured correctly. If the hostname has changed since installation this could be incorrect if it was'nt reconfigured.