Is there a way to know the SQL Always On Cluster name in a SQL Server query

823 Views Asked by At

I have a SQL Server Always On cluster set up. The cluster name is:

DBCLUSTER001.mydomain.net

It has a few nodes (virtual servers) for fail overs.

Let's say they are:

Node1,
Node2, etc...

To know which node is currently active I run this

SELECT activeServer = @@SERVERNAME;
-- Let's say, it resulted in 'Node1'

What I'm trying to find out that is there a SQL command or query that I can run from the current active node (Node1) to get the cluster name?

It's like if there is something like

SELECT * 
FROM <something; a function, table, command> 
--my expected output is: DBCLUSTER001.mydomain.net

This is what I'm trying to achieve.

I am looking in to the SQL Server Operating System queries, but so far they all are giving me the Node info only.

Is getting the cluster name actually possible?

I am using SQL Server 2019.

0

There are 0 best solutions below