| title | @@SERVICENAME (Transact-SQL) | |||
|---|---|---|---|---|
| description | @@SERVICENAME (Transact-SQL) | |||
| author | VanMSFT | |||
| ms.author | vanto | |||
| ms.date | 09/18/2017 | |||
| ms.service | sql | |||
| ms.subservice | t-sql | |||
| ms.topic | reference | |||
| f1_keywords |
|
|||
| helpviewer_keywords |
|
|||
| dev_langs |
|
|||
| monikerRange | = azuresqldb-mi-current || >= sql-server-2016 || >= sql-server-linux-2017 |
[!INCLUDE SQL Server - ASDBMI]
Returns the name of the registry key under which [!INCLUDEssNoVersion] is running. @@SERVICENAME returns 'MSSQLSERVER' if the current instance is the default instance; this function returns the instance name if the current instance is a named instance.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
@@SERVICENAME
nvarchar
[!INCLUDEssNoVersion] runs as a service named MSSQLServer.
The following example shows using @@SERVICENAME.
SELECT @@SERVICENAME AS 'Service Name'; [!INCLUDEssResult]
Service Name
------------------------------
MSSQLSERVER
Configuration Functions (Transact-SQL)
Manage the Database Engine Services