Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

T-SQL to find if a Database is Subscribed on the Subscriber in Transactional Replication

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')
like image 850
Afroz Avatar asked Jun 05 '13 17:06

Afroz


1 Answers

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
like image 73
Afroz Avatar answered Nov 15 '22 07:11

Afroz