T-SQL to find if a Database is Subscribed on the Subscriber in Transactional Replication. I don't want to query Distribution for the details.
The following doesn't work.
SELECT is_subscribed FROM sys.databases
SELECT DATABASEPROPERTYEX('database', 'IsSubscribed')
So far this is the best way I found but I am not sure if this works in Non-Transactional Replication.
SELECT COALESCE(OBJECTPROPERTY(OBJECT_ID('dbo.MSreplication_objects'), 'IsMSShipped'),0) AS IsSubscribed
OR
SELECT name
FROM sys.databases
WHERE OBJECT_ID(name+'.dbo.MSreplication_objects') IS NOT NULL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With