T-SQL - Get Listener Name on AlwaysOn Cluster

ben himself's picture

Books Online: https://msdn.microsoft.com/en-us/library/hh231289.aspx

When using AlwaysOn, you must connect using your listener name, not your node name.  If you connect with the node name, it will only work until there is a failover, which would defeat the purpose of your High Availability setup, right?  You can use your GUI to find the listener name, or you can do it the quick way using T-SQL, like this: