SQL Server: SELECT Machine, Computer, Instance Names
Jun.26, 2007 in
Geeky/Programming, SQLServerPedia Syndication
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
