The EnableMergeSubscription method enables a Subscriber-originated (pull) subscription at the Publisher and Distributor.
object.EnableMergeSubscription( Subscriber, SubscriptionDatabase,
Publication , [ SubscriptionType ] , [ SyncType ] , [ SubscriberType ] ,
[ SubscriptionPriority ] )
Part | Description |
---|---|
object | Expression that evaluates to an object in the Applies To list. |
Subscriber | String identifying the Subscriber by name. |
SubscriptionDatabase | String identifying a Microsoft® SQL Server™ database existing on the Subscriber and used for replicated article storage. |
Publication | String identifying an existing merge replication publication maintained on the referenced database. |
SubscriptionType | Long integer specifying a subscription direction. Must evaluate to SQLDMOSubscription_Pull. |
SyncType | Long integer specifying a method for synchronization as described in Settings. |
SubscriberType | Long integer specifying merge Subscriber visibility as described in Settings. |
SubscriptionPriority | Float specifying relative priority for conflict resolution as described in Settings. |
Set the SyncType argument by using these values.
Constant | Value | Description |
---|---|---|
SQLDMOSubSync_Auto | 1 | Subscription agent will synchronize the subscription automatically. |
SQLDMOSubSync_Default | 1 | SQLDMOSubSync_Auto. |
SQLDMOSubSync_Max | 2 | SQLDMOSubSync_None. |
SQLDMOSubSync_Min | 1 | SQLDMOSubSync_Auto. |
SQLDMOSubSync_None | 2 | Subscription agent will not attempt publication synchronization. User interaction necessary to ensure synchronization. |
Set the SubscriberType argument by using these values.
Constant | Value | Description |
---|---|---|
SQLDMOMergeSubscriber_ Anonymous |
3 | Anonymous subscription |
SQLDMOMergeSubscriber_Default | 2 | SQLDMOMergeSubscriber_ Local |
SQLDMOMergeSubscriber_Global | 1 | Global subscription |
SQLDMOMergeSubscriber_Local | 2 | Local subscription |
When setting the SubscriptionPriority argument, use the value specified in SubscriberType to determine applicable priorities.
SubscriberType | SubscriptionPriority |
---|---|
SQLDMOMergeSubscriber_Anonymous or SQLDMOMergeSubscriber_Local |
Must be 0.0 |
SQLDMOMergeSubscriber_Global | Value from 0.0 through 100.0 |
Creating a pull subscription by using SQL-DMO is a two-step process. The application must define the subscription at the Subscriber, then, separately, enable the subscription at the Publisher and Distributor.
To create a pull subscription to a merge replication publication
For more information on creating pull subscriptions to merge replication publications by using SQL-DMO, see MergePullSubscription Object.
HRESULT EnableMergeSubscription(SQLDMO_LPCSTR Subscriber, SQLDMO_LPCSTR SubscriptionDatabase,
SQLDMO_LPCSTR Publication,
SQLDMO_SUBSCRIPTION_TYPE SubscriptionType = SQLDMOSubscription_Pull
SQLDMO_SUBSYNC_TYPE SyncType = SQLDMOSubSync_Auto,
SQLDMO_MERGESUBSCRIBER_TYPE SubscriberType =
SQLDMOMergeSubscriber_Local,
float SubscriptionPriority = 0.0));