Udostępnij za pośrednictwem


@@SERVICENAME (Transact-SQL)

Returns the name of the registry key under which SQL Server 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.

Ikona łącza do tematu Transact-SQL Syntax Conventions

Składnia

@@SERVICENAME

Return Types

nvarchar

Uwagi

SQL Server runs as a service named MSSQLServer.

Examples

The following example shows using @@SERVICENAME.

SELECT @@SERVICENAME AS 'Service Name'

Here is the result set.

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

Zobacz także

Odwołanie

Configuration Functions (Transact-SQL)

Koncepcje

Manage the Database Engine Services