In this blog, we will simply show how to get the full SQL Server Instance Name using "SERVERPROPERTY"
What's the "SERVERPROPERTY"?
"SERVERPROPERTY" is a System-defined Function used to return the SQL Server instance information.
"SERVERPROPERTY" Syntax
- SERVERPROPERTY ('propertyname')
SERVERNAME
Use SERVERNAME property to get the full SQL Server instance name.Example
- Select SERVERPROPERTY('servername') as 'Server Name'.
Output
SERVERINSTANCE
Use SERVERINSTANCE property to get the SQL Server instance name to which the user is connected.
Example
Example
- Select SERVERPROPERTY('serverinstance') as 'Server Name'
Output

Applies To

Applies To
- SQL Server 2008.
- SQL Server 2012.
- SQL Server 2014.
- SQL Server 2016.
- SQL Server 2017.
Reference
See Also
Download the "Get The Detailed SQL Server Information" Script.

SubashPosted Aug 9, 2018, 8:23 PM
Very nice article
Hadshana KamalanathanPosted Jul 16, 2018, 8:19 PM
Nice,Thank you for sharing