Our company now has a Sql Cluster consisting of two different Sql Servers. This works fine.
The difficulty, however, is knowing which server you are on. For the purpose of making sure that an SP is on Prod (and not on Test) we often do a check on which server the sql code is currently running on. However, with a Cluster, the server's name can change, depending on which server is the is.
This is how we are currently doing it: if @@SERVERNAME in ('SQLServer1','SQLServer2')
This is what we would like to do so we are not hardcoding Server names:
if @@SERVERNAME = 'SqlCluster'
Any suggestions? This is on Sql Server 2022