Creating replicate articles

Before you can create a replicate article, you must create a replicate database connection, and create at least one subscription in that connection.

Each replicate article identifies a replicate object (table or stored procedure) that subscribes to a primary article (published primary object). Therefore, the name of a replicate article is the same as the name of the replicate object it identifies. Typically, a primary object and a replicate object have the same name, but they can have different names.

NoteIf the replicate table does not exist in the replicate database before you create a replicate article, ASE Replicator creates the replicate table in the replicate database, using the name of the primary article.

When you create a replicate article, you have two options for selecting the published fields (table columns or stored procedure parameters) to be subscribed to by the replicate article. You can either subscribe to all the published fields, or specify individual published fields to be subscribed to by the replicate article.

NoteYou must suspend the subscription before you create a replicate article. See “Suspending and resuming subscriptions” for more information.

To create a replicate article and subscribe to all published fields, use sp_addreplicateart and specify only the subscription name and the name of the primary article (primary object) that the replicate article subscribes to:

sp_addreplicateart sub_name, pri_art

where sub_name is the name of the subscription, and pri_art is the name of the primary article that the replicate article subscribes to.

If the name of the replicate object is not the same as the name of the primary object, then the name of the replicate article cannot be the same as the name of the primary article. The sp_addreplicateart procedure allows you to specify a different name for the replicate article (and replicate object) when you create a replicate article.

To create a replicate article with a different name from the primary article, use sp_addreplicateart and specify the subscription name, the name of the primary article (primary object) that the replicate article subscribes to, and the name of the replicate article (replicate object):

sp_addreplicateart sub_name, pri_art, rep_art

where sub_name is the name of the subscription, pri_art is the name of the primary article that the replicate article subscribes to, and rep_art is the name of the replicate article.

To create a replicate article and subscribe to specified published fields, use sp_addreplicateart and specify the subscription name, the name of the primary article (primary object) that the replicate article subscribes to, the name of the replicate article (replicate object in the replicate database), and the numbers of the published fields (columns or parameters) to be subscribed to:

sp_addreplicateart sub_name, pri_art, rep_art, "fields"

where sub_name is the name of the subscription, pri_art is the name of the primary article that the replicate article subscribes to, rep_art is the name of the replicate article, and fields is a numeric list of the published fields to subscribe to.

In addition to selecting from the published fields, you can specify a where clause to select the data to be replicated based on the value or values in the published fields.

To create a replicate article with a where clause, use sp_addreplicateart and specify the subscription name, the name of the primary article (primary object) that the replicate article subscribes to, the name of the replicate article (replicate object in the replicate database), the numbers of the published fields to be subscribed to (optionally), and the where clause:

sp_addreplicateart sub_name, pri_art, rep_art, "fields", "where_clause"

where sub_name is the name of the subscription, pri_art is the name of the primary article that the replicate article subscribes to, rep_art is the name of the replicate article, fields is a numeric list of the published fields to subscribe to, and where_clause is the where clause that selects the data to be replicated from the specified published fields.