@@SERVERNAME#
Returns the name of the local server: the same name SERVERPROPERTY('ServerName'), SERVERPROPERTY('MachineName')
and the server_id 0 row of sys.servers report.
On a single node it is the computer name of the host Querona runs on. On a node of a two-node cluster it is the first
label of the cluster name, in the case it is stored in: querona for a cluster named querona.contoso.com. It is
the same on both nodes and does not change when the serving role moves to the other node. A node reads the name when it
starts, so after
qua_cluster_set_name renames
the cluster, each node reports the new name from its next start. A cluster provisioned before the cluster name was recorded reports the host name of the serving node instead, and the
node logs a warning when it starts.
The value does not depend on the name the client connected by: a client that connects by localhost, an IP address or
a fully qualified name gets the same value. A job step gets it too.
Syntax#
@@SERVERNAME
Return types#
nvarchar
Example#
SELECT @@SERVERNAME AS ServerName;