TransPublication Object (SQL-DMO)
The TransPublication object represents a transactional or snapshot publication. A publication contains one or more articles (tables or stored procedures) that contain replicated data.
Remarks
With the TransPublication object, you can:
- Create a transactional publication.
- Change the properties of an existing transactional publication.
- Enable a transactional publication after all articles have been added.
- Create a snapshot publication.
- Change the properties of an existing snapshot publication.
- Enable a snapshot publication after all articles have been added.
To create a transactional publication
- Create a new TransPublication object.
- Set the Name property.
- Note that the ReplicationFrequency property defaults to SQLDMORepFreq_Continuous, which specifies a transactional publication.
- Set the PublicationAttributes property as appropriate.
- To enable push subscriptions, use SQLDMOPubAttrib_AllowPush.
- To enable pull subscriptions, use SQLDMOPubAttrib_AllowPull.
- To enable anonymous subscriptions, use SQLDMOPubAttrib_AllowPull, SQLDMOPubAttrib_AllowAnonymous and SQLDMOPubAttrib_ImmediateSync.
- To enable Internet subscriptions, use SQLDMOPubAttrib_InternetEnabled.
- Add the TransPublication object to the TransPublications collection of a connected ReplicationDatabase object.
To alter a transactional publication
- Get a TransPublication object from the TransPublications collection of a connected ReplicationDatabase object.
- Use the BeginAlter method to mark the beginning of the changes.
- Set the TransPublication object properties to reflect the changes to the transactional publication.
- Use the DoAlter method to submit the changes to Microsoft® SQL Server™.
To enable a transactional publication after all articles have been added
- Get a TransPublication object from the TransPublications collection of a connected ReplicationDatabase object.
- Set the Enabled property to True.
To create a snapshot publication
- Create a new TransPublication object.
- Set the Name property.
- Set the ReplicationFrequency property to SQLDMORepFreq_Snapshot.
- Set the PublicationAttributes property as appropriate.
- To enable push subscriptions, use SQLDMOPubAttrib_AllowPush.
- To enable pull subscriptions, use SQLDMOPubAttrib_AllowPull.
- To enable anonymous subscriptions, use SQLDMOPubAttrib_AllowPull, SQLDMOPubAttrib_AllowAnonymous, and SQLDMOPubAttrib_ImmediateSync.
- To enable Internet subscriptions, use SQLDMOPubAttrib_InternetEnabled.
- Add the TransPublication object to the TransPublications collection of a connected ReplicationDatabase object.
To alter a snapshot publication
- Get a TransPublication object from the TransPublications collection of a connected ReplicationDatabase object.
- Use the BeginAlter method to mark the beginning of the changes.
- Set the TransPublication object properties to reflect the changes to the snapshot publication.
- Use the DoAlter method to submit the changes to SQL Server.
To enable a transactional publication after all articles have been added
- Get a TransPublication object from the TransPublications collection of a connected ReplicationDatabase object.
- Set the Enabled property to True.
Methods
Properties
(c) 1988-98 Microsoft Corporation. All Rights Reserved.