Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

@@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.

Topic link icon 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 is the result set.

Service Name                  
------------------------------
MSSQLSERVER                   
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.