Creates a new primary article (or articles) in a specified publication.
sp_addprimaryart pub_name [, pri_art [, field_nums]]
is the name of the publication to which the new article is added.
is the name of a primary object. Primary object names can be specified in the form owner.name.
is one or more numbers that identify the fields to be published. Numbers can be entered with separating commas, or with dashes to indicate inclusive ranges.
sp_addprimaryart pubdoc, table1
Creates a new primary article in the publication pubdoc for the primary object table1, with all fields in the primary object published, or adds an existing primary article named table1 to the publication pubdoc.
sp_addprimaryart pubdoc, table1, "2-6, 8"
Creates a new primary article in the publication pubdoc for the primary object table1, publishing only fields (columns) 2, 3, 4, 5, 6, and 8 from the primary object.
Before you invoke sp_addprimaryart to create a primary article, suspend the database connection using sp_suspendprimaryconn. After the primary article is created, you can resume the database connection with sp_resumeprimaryconn.
To publish a primary object, you must first create a publication with sp_addpub, and then use sp_addprimaryart to create a primary article for the primary object. Creating a primary article publishes the primary object for replication. Only existing user tables and user stored procedures can be published in primary articles.
When a primary article is first created, you can specify the fields (columns or parameters) of the primary object for publication. After a primary article is created, it can be added to other publications, however, field selection is no longer available. If you want to publish a different set of fields for an existing primary article, first delete the primary article from all publications it belongs to, then re-create the primary article with a different set of fields.
When you publish a table, you must publish at least one field (column).
When you publish a stored procedure, you can choose to publish none of the input parameters of the procedure. To specify none of the input parameters for publication, use the number 0 (zero) for the field_nums parameter in sp_addprimaryart. For example:
sp_addprimaryart pubdoc, proc1, "0"
If you need to change a published primary table or stored procedure in a way that affects its entry in the sysobjects table, you must first delete the primary article from all publications it belongs to, alter the table or stored procedure, then re-create the primary article.
See the Adaptive Server Reference Manual for more information on object changes that affect the sysobjects table.
If the primary object (pri_art) is a table, the fields available for publication are the columns in the table. If the primary object (pri_art) is a stored procedure, the fields available for publication are the stored procedure’s input parameters (if any).
If the name of a field (column or parameter) in a primary object conflicts with the name of a shadow table column, ASE Replicator returns an error message indicating that the primary object cannot be published because of a field name conflict. In that event, you must change the name of the field in the primary object if you want to publish the object.
See “Distribution Database shadow tables” for more information about shadow table column names.
ASE Replicator creates a table named rl_lastcommit in the replicate database to keep track of transactions committed there. If you create a primary database connection to a replicate database (to implement bidirectional replication, for example), you cannot publish the rl_lastcommit table.
ASE Replicator does not support replicating transactions to or from the rl_lastcommit table.
When sp_addprimaryart is invoked with no primary object (pri_art) specified, all user tables and user procedures in the primary database are published.
System tables and system procedures are not published by using the sp_addprimaryart procedure with no primary object specified.
When sp_addprimaryart is invoked with a primary object (pri_art) specified, all fields in the specified primary object are published.
When sp_addprimaryart is invoked with a primary object (pri_art) specified and field numbers (field_nums) specified, only the specified fields in the primary object are published.
When the requested action occurs successfully, no results are returned.
When an error occurs, an error message is returned.
sp_addprimaryconn, sp_addpub, sp_addreplicateart, sp_helpprimaryart, sp_helpprimaryconn, sp_helppub