SQL Server - Get The Full SQL Server Instance Name

Get the full SQL Server instance name via "ServerProperty". In this blog, we will simply show How to Get the full SQL Server Instance Name using "SERVERPTOPERTY".

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

  1. SERVERPROPERTY ('propertyname')

SERVERNAME

Use SERVERNAME property to get the full SQL Server instance name.

Example

  1. 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
  1. Select SERVERPROPERTY('serverinstance') as 'Server Name'
Output



Applies To
  • SQL Server 2008.
  • SQL Server 2012.
  • SQL Server 2014.
  • SQL Server 2016.
  • SQL Server 2017.

Reference

See Also