create article

Description

Creates an article for a table or function replication definition and specifies the publication that is to contain the article.

Syntax

create article article_name
        for pub_name
with primary at data_server.database
with replication definition {table_rep_def | function_rep_def}
        [where {column_name | @param_name}
                {< | > | >= | <= | = | &} value
        [and {column_name | @param_name}
                {< | > | >= | <= | = | &} value]...
        [or where {column_name | @param_name}
                {< | > | >= | <= | = | &} value 
        [and {column_name | @param_name}
                {< | > | >= | <= | = | &} value]...]...]

Parameters

article_name

A name for the article. It must conform to the rules for identifiers and be unique within the publication.

for pub_name

The name of the publication that contains the article.

with primary at data_server.database

Specifies the location of the primary data. If the primary database is part of a warm standby application, data_server.database is the name of the logical data server and database.

with replication definition table_rep_def

Specifies the name of the table replication definition the article is for.

with replication definition function_rep_def

Specifies the name of the function replication definition the article is for.

where

Sets criteria for the column or parameter values to be replicated via a subscription to the publication that contains this article. If no where clause is included, all rows or parameters are replicated.

A where clause is composed of one or more simple comparisons, where a searchable column or searchable parameter is compared to a literal value with one of the following relational operators: <, >, <=, >=, =, or &. (The & operator is supported only for rs_address columns or parameters.) You can join comparisons with the keyword and.

Column or parameter names used in a where clause must also be included in the searchable columns list of the table replication definition or the searchable parameters list of the function replication definition.

You can include multiple where clauses in an article, separated with the keyword or.

The maximum size of a where clause in an article is 255 characters.

column_name

A column name from the primary table, for an article that contains a table replication definition.

@param_name

A parameter name from a replicated stored procedure, for an article that contains a function replication definition.

value

A value for a specified column or parameter. See “Datatypes” for entry formats for values for different datatypes.

Column or parameter names used in the expression must be included in the searchable columns or searchable parameters list of the replication definition.

Examples

Example 1

Creates an article called titles_art for the publication pubs2_pub, based on the replication definition titles_rep:

create article titles_art
 for publication pubs2_pub
 with primary at TOKYO_DS.pubs2
 with replication definition titles_rep

Example 2

Creates an article called titles_art for the publication pubs2_pub, as in the previous example. This command includes a where clause that replicates only the rows for popular computing books, for which the type column is set to “popular_comp”:

create article titles_art
 for publication pubs2_pub
 with primary at TOKYO_DS.pubs2
 with replication definition titles_rep
 where type = 'popular_comp'

Example 3

Creates an article called titles_art for the publication pubs2_pub, as in the previous examples. This command includes two where clauses that together replicate the rows for both popular computing books and traditional cookbooks:

create article titles_art
 for publication pubs2_pub
 with primary at TOKYO_DS.pubs2
 with replication definition titles_rep
 where type = 'popular_comp'
 or where type = 'trad_cook'

Usage


Requirements for using create article


Adding articles to a new publication


Articles and subscriptions


Adding articles to a publication with a subscription

Permissions

create article requires “create object” permission.

See also

check publication, create applied function replication definition, create publication, create replication definition, create request function replication definition, create subscription, define subscription, drop article, drop publication, validate publication