Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 2.09 KB

File metadata and controls

64 lines (50 loc) · 2.09 KB
title @@SERVICENAME (Transact-SQL)
description @@SERVICENAME (Transact-SQL)
author VanMSFT
ms.author vanto
ms.reviewer
ms.date 09/18/2017
ms.prod sql
ms.prod_service sql-database
ms.technology t-sql
ms.topic reference
ms.custom
f1_keywords
@@SERVICENAME_TSQL
@@SERVICENAME
helpviewer_keywords
@@SERVICENAME function
names [SQL Server], registry keys
registry keys [SQL Server]
dev_langs
TSQL
monikerRange = 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.

Topic link icon 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