The EnableTransSubscription method enables a Subscriber-originated (pull) subscription at the Publisher and Distributor.
object.EnableTransSubscription( Subscriber , SubscriptionDatabase ,
Publication , [ SubscriptionType ] , [ SyncType ] , [ SubscriberType ] )
object
Expression that evaluates to an object in the Applies To list.
Subscriber
String that identifies the Subscriber by 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 transactional or snapshot 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 transactional replication Subscriber visibility as described in Settings.
HRESULT EnableTransSubscription(
SQLDMO_LPCSTR Subscriber,
SQLDMO_LPCSTR SubscriptionDatabase,
SQLDMO_LPCSTR Publication,
SQLDMO_SUBSCRIPTION_TYPE SubscriptionType = SQLDMOSubscription_Pull
SQLDMO_SUBSYNC_TYPE SyncType,
SQLDMO_TRANSUBSCRIBER_TYPE SubscriberType);
Set the SyncType argument using these SQLDMO_SUBSCRIPTION_TYPE values.
Constant | Value | Description |
---|---|---|
SQLDMOSubSync_Auto | 1 | Subscription agent will synchronize the subscription automatically. |
SQLDMOSubSync_Default | 1 | Default. SQLDMOSubSync_Auto. |
SQLDMOSubSync_None | 2 | Subscription agent will not attempt publication synchronization. User interaction necessary to ensure synchronization. |
Set the SubscriberType argument using these SQLDMO_TRANSUBSCRIBER_TYPE values.
Constant | Value | Description |
---|---|---|
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. |
SQLDMOTranSubscriber_Default | 0 | SQLDMOTranSubscriber_ReadOnly. |
SQLDMOTranSubscriber_Failover | 3 | Transactional Immediate Updating Subscriber with capability to fail over to queued Subscriber. |
SQLDMOTranSubscriber_Queued | 2 | Subscriber update to a publication article is applied as a queued transaction. |
SQLDMOTranSubscriber_ReadOnly | 0 | Default. Subscriber update to any publication article affects only the image maintained at the Subscriber. |
SQLDMOTranSubscriber_Unknown | 256 | Bad or invalid value. |
Creating a pull subscription 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 about creating pull subscriptions to transactional and snapshot replication publications using SQL-DMO, see TransPullSubscription Object.