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 [gs string] or you will get errors in your [gs stored procedure]s/[gs query]/ies.
SOURCE | LINK | LANGUAGE | ENGLISH |
Hey dude, did you know? Select Machine Name (Client or Server) and Instance Names (SQL Server) – http://heelpbook.altervista.org/?p=35138 (Visit us on http://www.heelpbook.net) – Enjoy!
Select Machine Name (Client or Server) and Instance Names (SQL Server) http://heelpbook.altervista.org/2012/select-machine-name-client-or-server-and-instance-names-sql-server/ via @HeelpBook