T-SQL Tutorial

T-SQL @@ServiceName function


The T-SQL @@ServiceName function returns the instance name if the current instance is a named instance.

@@ServiceName Syntax

@@SERVICENAME;

@@ServiceName Example

SELECT @@SERVICENAME AS 'Instance Service Name';

Instance Service Name
MSSQLSERVER

See also:
T-SQL Functions -> @@SERVERNAME