Tuesday, March 27, 2012

distinguish between the Publisher and the Subscribers

I have a database on SQL Sever 2005 SP1 against which a Publication has been defined and to which many servers (both Workgroup and Express editions - SP1) Subscribe to.

I would like to be able to distinguish between the Publisher and the Subscribers programmatically via T-SQL.

From reading BoL and various forums it appears that the IsPublished, IsMergePublished and IsSubscribed options of the DatabasePropertyEx function should give me this information.

However within all our tested environments, whilst the IsMergePublished option returns expected values. IsPublished and IsSubscribed both return 0 on all servers (the Publisher and Subscribers).

Is this a know issue and how can I rectify the problem or alternatively does anyone know of another method to distinguishing between the Publishers and Subscribers.

Thanks

Hi Steve,

From BOL, IsPublished means "The tables of the database can be published for snapshot or transactional replication, if replication is installed.". So if your publication DB has merge publication, this value should be 0.

For IsSubscribed, looks like it is a documentation bug. I will open a bug for it.

Peng

|||Query distribution.dbo.MSmerge_subscriptions to find the subscribers. and distribution.dbo.MSpublications to find the publishers.

No comments:

Post a Comment