I want to connect to the listener in the AlwaysOn availability group and by running a query I will get the list of instances that are part of the AlwaysOn . For example: I has listener "MylistenerHost" and there are 2 instances connecting to him: SqlHost1(primary-readwrite) and SqlHost2(secondary - readonly) .
I need a query that I will run and he will show me these instantiates, SqlHost1 and SqlHost2 and that, SqlHost1 is the primary and SqlHost2 is the secondary.
10X