Skip to content

Commit 3058ec0

Browse files
committed
BrentOzarULTD#2790 sp_ineachdb Azure SQL DB compat
Closes BrentOzarULTD#2790.
1 parent 8a0fa13 commit 3058ec0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎sp_ineachdb.sql‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ OPTION (MAXRECURSION 0);
262262

263263
-- from Andy Mallon / First Responders Kit. Make sure that if we're an
264264
-- AG secondary, we skip any database where allow connections is off
265-
IF @SQLVersion >= 11
265+
IF @SQLVersion >= 11 AND 3 = (SELECT COUNT(*) FROM sys.all_objects WHERE name IN('availability_replicas','dm_hadr_availability_group_states','dm_hadr_database_replica_states'))
266266
BEGIN
267267
DELETE dbs FROM #ineachdb AS dbs
268268
WHERE EXISTS

0 commit comments

Comments
 (0)