Home Forums SQL Server 2014 Administration - SQL Server 2014 Determine Which Server is Currently Active for Availability Groups RE: Determine Which Server is Currently Active for Availability Groups
joshdbguy
SSCertifiable
Points: 7707
More actions
November 26, 2014 at 9:39 am
#1761132
So will this also work,
if (select ars.role
from sys.dm_hadr_availability_replica_states ars
where ars.is_local = 1) = 2
begin
raiserror ('This is not the primary replica.',2,1)
end