Share via


EnableMergeSubscription Method

Microsoft SQL Server의 이후 버전에서는 이 기능이 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 말고, 현재 이 기능을 사용하는 응용 프로그램은 수정하십시오.

The EnableMergeSubscription method enables a Subscriber-originated (pull) subscription at the Publisher and Distributor.

구문

object
.EnableMergeSubscription(
Subscriber
,
SubscriptionDatabase
,
Publication 
, [ SubscriptionType ] , [ SyncType ] , [ SubscriberType ] ,
[ SubscriptionPriority ] )

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • Subscriber
    String that identifies the Subscriber by name. This is the SQL Server instance name.
  • SubscriptionDatabase
    String that identifies a Microsoft SQL Server 2000 database that exists on the Subscriber and is used for replicated article storage.
  • Publication
    String that identifies an existing merge replication publication maintained on the referenced database.
  • SubscriptionType
    Long integer that specifies a subscription direction. Must evaluate to SQLDMOSubscription_Pull.
  • SyncType
    Long integer that specifies a method for synchronization as described in Settings.
  • SubscriberType
    Long integer that specifies merge Subscriber visibility as described in Settings.
  • SubscriptionPriority
    Float that specifies relative priority for conflict resolution as described in Settings.

Prototype (C/C++)

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));

Settings

Set the SyncType argument using these values.

Constant Value Description

SQLDMOSubSync_Auto

1

Subscription agent will automatically synchronize the subscription.

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 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 using SQL Distributed Management Objects (SQL-DMO) is a two-step process. The application must define the subscription at the Subscriber, and then separately enable the subscription at the Publisher and Distributor.

To create a pull subscription to a merge replication publication

  1. Establish a SQLServer object connection to the Subscriber.

  2. Create and populate a MergePullSubscription object.

  3. Add the MergePullSubscription object to the MergePullSubscriptions collection of the appropriate ReplicationDatabase object.

  4. Establish a SQLServer object connection to the Publisher.

  5. Use the EnableMergeSubscription method of the appropriate ReplicationDatabase object indicating the subscription created in Step 3.

For more information about creating pull subscriptions to merge replication publications using SQL-DMO, see MergePullSubscription Object.

Applies To:

ReplicationDatabase Object