Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » Configuration FunctionsRSS Feeds

@@SERVICENAME - SERVICENAME Function

Posted By: Sarita Patel     Category: SQL Server     Views: 1401

This article explains about @@SERVICENAME function in sql server with examples.

@@SERVICENAME function is used to get 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.


Syntax of @@SERVICENAME Function :

@@SERVICENAME

Return type of @@SERVICENAME function is nvarchar.



Examples of @@SERVICENAME Function :

Example 1 : Use of @@SERVICENAME function in select clause

SELECT @@SERVICENAME

Output
SQLEXPRESS

Above example returns current service name set for sql server.
  
Share: 


Didn't find what you were looking for? Find more on @@SERVICENAME - SERVICENAME Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of @@SERVICENAME - SERVICENAME Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!