Home » SQL Server @@Servicename

SQL Server @@Servicename

SQL @@servicename is SQL Server configuration function which returns the name of the registry key under which SQL Server is running.





This function does not require any argument, you can simply use it in a select statement to return the registry key’s name.

It returns ‘MSSQLSERVER’ if the current instance is the default instance.

SYNTAX

@@servicename

 

Lets look at an example of SQL Server @@servicename.

Following SQL Statement uses @@servicename function which returns the name of SQL Server service which is currently running.

SELECT @@SERVICENAME AS [Service Name]

You can also read following SQL Configuration function.

SQL Server @@VERSION

SQL Server @@SPID

SQL Server @@Language



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.