Cannot select master database for SQL Server

Why can’t I select the master database for SQL Server? I have the correct permissions

Why do you want to select master db? What is in their that you need to query?

Always On stats from master views

Okay scratch that. I got it to work in Explorer by using this:

SELECT [database_name]
FROM [master].[sys].[dm_hadr_database_replica_cluster_states]

However in the Explorer the is_failover_ready comes back as true/false. In SSMS it comes back as a 0 or 1. Why the change and how can I get that as a value in Alerting?

Here is the error I’m getting

I think I figured it out. Adding CAST(column AS INT) got it

SELECT CURRENT_TIMESTAMP AS “time”, database_name, CAST(is_failover_ready AS INT) FROM master.sys.dm_hadr_database_replica_cluster_states

Gave me the results I wanted and the dynamic labels

1 Like