Chapter 8. SQL Remote Design for Adaptive Server Enterprise

Subscription column SQL Remote for Adaptive Server Anywhere supports expressions other than column names. For Adaptive Server Enterprise, the subscription expression must be a column name.

When to use WHERE You should use a subscription expression when different subscribers to a

and SUBSCRIBE BY publication are to receive different rows from a table. The subscription expression is the most powerful method of partitioning tables.

Creating an article using a WHERE clause

The WHERE clause is used to exclude a set of rows from all subscriptions to a publication.

To create an article using a WHERE clause

1. If you have not already done so, mark the table for replication. You do this by executing the sp_add_remote_table procedure:

sp_add_remote_table table_name

2. Add the table to the publication. You do this by executing the sp_add_article procedure: Specify the column name corresponding to the WHERE column IS NOT NULL clause in the third argument to the procedure:

sp_add_article publication_name, table_name,

column_name

 

 

Do not specify IS NOT NULL; it is implicit. Specify the column name

 

 

only.

 

3.

If you wish to include only a subset of the columns in the table, specify

 

 

the columns using the sp_add_article_col procedure. You must include

 

 

the column specified in your WHERE clause in the article.

Example

The following set of statements create a publication containing a single

 

 

article, which includes only those rows of test_table for which column

 

 

col_1 is not null:

sp_create_publication test_pub sp_add_remote_table test_table sp_add_article test_pub, test_table, col_1 go

Creating an article using a subscription column

The subscription column is used when rows are to be shared among many remote databases.

145

Page 163
Image 163
Sybase DC38133-01-0902-01 manual Creating an article using a Where clause, To create an article using a Where clause