Compartir a través de


EnableMergeSubscription Method

Esta característica se quitará en una versión futura de Microsoft SQL Server. Evite utilizar esta característica en nuevos trabajos de desarrollo y tenga previsto modificar las aplicaciones que actualmente la utilizan.

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

Sintaxis

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.

Notas

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.