Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to: SQL Server Azure SQL Managed Instance
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.
Transact-SQL syntax conventions
@@SERVICENAME
nvarchar
SQL Server runs as a service named MSSQLServer.
The following example shows using @@SERVICENAME
.
SELECT @@SERVICENAME AS 'Service Name';
Here's the result set.
Service Name
------------------------------
MSSQLSERVER
Configuration Functions (Transact-SQL)
Manage the Database Engine Services
Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register today