Monday, March 12, 2012

Programmatically reinitializing merge subscription from publisher - SQL 2005

From the SSMS GUI it is possible to re-initialize one or all subscriptions to a merge publication. This is done at the publisher.

How can I achieve these operations programmatically?

In particular, how do I initialize a single merge subscription from the publisher?

I have looked at the documentation for sp_reinitmergepullsubscription but it says that this proc must be run at the subscriber - which isn't much use when subscribers are disconnected for the majority of the time

I have a large number of merge subscribers and want to reinitialize all except one

aero1

You can use the following statement to re-initiliase your subscribers:

exec sp_reinitmergesubscription @.publication=<Publication Name>, @.subscriber=<Subscriber Name>, @.subscriber_db = <Subscriber DB>, @.upload_first = <TRUE|FALSE>

You can get the details of the subscribers from the sysmergesubscriptions table.

More info on re-intiialising here:

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/249a4048-e885-48e0-a92a-6577f59de751.htm

|||

Just what I needed

Thanks

aero1

No comments:

Post a Comment