snippetsqlMinor
Sql Server : How to query list of subscriptions and Articles (for a given publication) from Publisher
Viewed 0 times
sqlqueryandgivenarticlespublicationforpublisherhowserver
Problem
In Sql Server 2014, how to query a list of Subscriptions & its articles for a given Publication from Publisher? (transactional replication)
Yes, there are easier ways to query from Distributor but I need a query from Publisher side.
Remote Distributor model (if it helps)
Thanks,
Yes, there are easier ways to query from Distributor but I need a query from Publisher side.
Remote Distributor model (if it helps)
Thanks,
Solution
To get subscription list from a publisher database, you can run below tsql :
Incase if someone needs for merge replication :
use publisherDB;
select
db_name() PublisherDB
, sp.name as PublisherName
, sa.name as TableName
, UPPER(srv.srvname) as SubscriberServerName
from dbo.syspublications sp
join dbo.sysarticles sa on sp.pubid = sa.pubid
join dbo.syssubscriptions s on sa.artid = s.artid
join master.dbo.sysservers srv on s.srvid = srv.srvidIncase if someone needs for merge replication :
use publisherDB
go
select distinct
sa.name as articlename,
sp.publisher as publisherserver,
sp.publisher_db as publisherdb,
sp.name as publicationname
,ss.subscriber_server as subscriberservername
from dbo.sysmergearticles sa
join dbo.sysmergepublications sp on sa.pubid = sp.pubid
join dbo.sysmergesubscriptions ss on ss.pubid = sa.pubid
order by subscriberservernameCode Snippets
use publisherDB;
select
db_name() PublisherDB
, sp.name as PublisherName
, sa.name as TableName
, UPPER(srv.srvname) as SubscriberServerName
from dbo.syspublications sp
join dbo.sysarticles sa on sp.pubid = sa.pubid
join dbo.syssubscriptions s on sa.artid = s.artid
join master.dbo.sysservers srv on s.srvid = srv.srviduse publisherDB
go
select distinct
sa.name as articlename,
sp.publisher as publisherserver,
sp.publisher_db as publisherdb,
sp.name as publicationname
,ss.subscriber_server as subscriberservername
from dbo.sysmergearticles sa
join dbo.sysmergepublications sp on sa.pubid = sp.pubid
join dbo.sysmergesubscriptions ss on ss.pubid = sa.pubid
order by subscriberservernameContext
StackExchange Database Administrators Q#222460, answer score: 8
Revisions (0)
No revisions yet.