The @@SERVICENAME is one of the Configuration functions used to return the registry key under which the SQL Server is currently running. If it is a default instance, it will write MSSQLSERVER as the service name. And if it is a named instance, it will return the instance name.

The syntax behind this SQL @@SERVICENAME is shown below.


The below code snippet will show the SQL Server service name we are currently running.


About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.