Chapter 7. SQL Remote Design for Adaptive Server Anywhere

 

To publish only some columns in a table (SQL)

 

1. Connect to the database as a user with DBA authority.

 

2. Execute a CREATE PUBLICATION statement that specifies the

 

publication name and the table name. List the published columns in

 

parenthesis following the table name.

Example

The following statement creates a publication that publishes all rows of

 

the id, company_name, and city columns of the customer table:

 

CREATE PUBLICATION pub_customer (

 

TABLE customer (

 

id,

 

company_name,

 

city )

 

)

 

For more information, see the “CREATE PUBLICATION statement”

 

[ASA SQL Reference, page 385].

Publishing only some rows in a table

You can create a publication that contains all the columns, but only some of the rows, of a table from Sybase Central. In either case, you do so by writing a search condition that matches only the rows you want to publish.

Sybase Central and the SQL language provide two ways of publishing only some of the rows in a table; however, only one way is compatible with MobiLink.

WHERE clause You can use a WHERE clause to include a subset of rows in an article. All subscribers to the publication containing this article receive the rows that satisfy the WHERE clause.

Subscription expression You can use a subscription expression to include a different set of rows in different subscriptions to publications containing the article.

You can combine a WHERE clause and a subscription expression in an article. You can specify them in Sybase Central or in a CREATE PUBLICATION statement.

Use the Subscription expression when different subscribers to a publication are to receive different rows from a table. The Subscription expression is the most powerful method of partitioning tables.

Use the WHERE clause to exclude the same set of rows from all subscriptions to a publication.

95

Page 113
Image 113
Sybase DC38133-01-0902-01 manual Publishing only some rows in a table, To publish only some columns in a table SQL