SQL SERVER – Find Instance Name for Availability Group Listener

How to Find Instance Name for Availability Group Listener? I was recently asked this by DBA at  Comprehensive Database Performance Health Check. Well, the question is very valid if you are familiar with how Availability Group Listener works.

SQL SERVER - Find Instance Name for Availability Group Listener Availability-Group-Listener-800x543

If you are connected to an Availability Group listener, the name displayed in Object Explorer and Properties may be different from what your instance name is actually. In this case, you may have to just use the T-SQL for the same.

Here is the T-SQL for the same.

SELECT @@Servername

Once you run the command above, it will give you a different server name from the Availability Group Listener name. Well, that’s it for today. What do you think of this small but very important blog post?

If you liked this blog, please do not forget to subscribe to my YouTube Channel – SQL in Sixty Seconds.

Here are my few recent videos and I would like to know what is your feedback about them.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

AlwaysOn, SQL Instance, SQL Scripts, SQL Server
Previous Post
SQL SERVER – Applying Query Hints to Views
Next Post
SQL SERVER – Using CASE Expression in Default Value

Related Posts

Leave a Reply