Microsoft SQL Server Getting started with Microsoft SQL Server Retrieve Basic Server Information


Example

SELECT @@VERSION

Returns the version of MS SQL Server running on the instance.

SELECT @@SERVERNAME

Returns the name of the MS SQL Server instance.

SELECT @@SERVICENAME

Returns the name of the Windows service MS SQL Server is running as.

SELECT serverproperty('ComputerNamePhysicalNetBIOS');

Returns the physical name of the machine where SQL Server is running. Useful to identify the node in a failover cluster.

SELECT * FROM fn_virtualservernodes();

In a failover cluster returns every node where SQL Server can run on. It returns nothing if not a cluster.