@@SERVICENAME (Transact-SQL)
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
Syntax
@@SERVICENAME
Note
To view Transact-SQL syntax for SQL Server 2014 (12.x) and earlier versions, see Previous versions documentation.
Return Types
nvarchar
Remarks
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
See Also
Configuration Functions (Transact-SQL)
Manage the Database Engine Services
प्रतिक्रिया
https://aka.ms/ContentUserFeedback.
जल्द आ रहा है: 2024 के दौरान हम सामग्री के लिए फीडबैक तंत्र के रूप में GitHub मुद्दों को चरणबद्ध तरीके से समाप्त कर देंगे और इसे एक नई फीडबैक प्रणाली से बदल देंगे. अधिक जानकारी के लिए, देखें:के लिए प्रतिक्रिया सबमिट करें और देखें