Skip to content

Latest commit

 

History

History
61 lines (47 loc) · 1.96 KB

servicename-transact-sql.md

File metadata and controls

61 lines (47 loc) · 1.96 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
@@SERVICENAME (Transact-SQL)
@@SERVICENAME (Transact-SQL)
VanMSFT
vanto
09/18/2017
sql
t-sql
reference
@@SERVICENAME_TSQL
@@SERVICENAME
@@SERVICENAME function
names [SQL Server], registry keys
registry keys [SQL Server]
TSQL
= azuresqldb-mi-current || >= sql-server-2016 || >= sql-server-linux-2017

@@SERVICENAME (Transact-SQL)

[!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

Syntax

@@SERVICENAME  

[!INCLUDEsql-server-tsql-previous-offline-documentation]

Return Types

nvarchar

Remarks

[!INCLUDEssNoVersion] runs as a service named MSSQLServer.

Examples

The following example shows using @@SERVICENAME.

SELECT @@SERVICENAME AS 'Service Name';  

[!INCLUDEssResult]

Service Name                    
------------------------------  
MSSQLSERVER                     

See Also

Configuration Functions (Transact-SQL)
Manage the Database Engine Services