The EnableTransSubscription method enables a Subscriber-originated (pull) subscription at the Publisher and Distributor.
object.EnableTransSubscription( Subscriber , SubscriptionDatabase ,
Publication , [ SubscriptionType ] , [ SyncType ] , [ SubscriberType ] )
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 transactional or snapshot 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 transactional replication Subscriber visibility 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 |
---|---|---|
SQLDMOTranSubscriber_Default | 0 | SQLDMOTranSubscriber_ ReadOnly |
SQLDMOTranSubscriber_Max | 1 | SQLDMOTranSubscriber_ Synchronous |
SQLDMOTranSubscriber_Min | 0 | SQLDMOTranSubscriber_ ReadOnly |
SQLDMOTranSubscriber_ReadOnly | 0 | Subscriber update to any publication article affects only the image maintained at the Subscriber |
SQLDMOTranSubscriber_ Synchronous |
1 | Subscriber update to a publication article is applied in a distributed transaction, updating the Publisher-maintained image for article data or failing entirely |
SQLDMOTranSubscriber_Unknown | 256 | Bad or invalid value |
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 transactional or snapshot replication publication
For more information on creating pull subscriptions to transactional and snapshot replication publications by using SQL-DMO, see TransPullSubscription Object.
HRESULT EnableTransSubscription(SQLDMO_LPCSTR Subscriber, SQLDMO_LPCSTR SubscriptionDatabase,
SQLDMO_LPCSTR Publication,
SQLDMO_SUBSCRIPTION_TYPE SubscriptionType = SQLDMOSubscription_Pull
SQLDMO_SUBSYNC_TYPE SyncType = SQLDMOSubSync_Auto,
SQLDMO_TRANSUBSCRIBER_TYPE SubscriberType =
SQLDMOTranSubscriber_ReadOnly);