SQL Server: SELECT Machine, Computer, Instance Names
Jun.26, 2007 in
Geeky/Programming
to get the instance name: SELECT @@ServerName
to get the machine name of the server: SELECT SERVERPROPERTY(”MachineName”)
to get the machine name of the computer running the query: SELECT host_name()
one tip: cast the serverproperty as a varchar if you want to use it in a string or you will get errors in your stored procs/queries.
Tags: SQL
Simlar Posts

July 17th, 2007 at 1:23 pm
[...] As a short follow up to a post I did a little while ago on SELECT’ing the instance and machine names from SQL Server, here is how you get the Current Database Name [...]