Publishing only some rows using a WHERE clause

You can specify a WHERE clause to include in the publication only the rows that satisfy the WHERE conditions.

To create a publication using a WHERE clause (Sybase Central)

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

2.In the left pane, select the Publications folder.

3.From the File menu, choose New Publication. The Publication Creation wizard opens.

4.Type a name for the new publication. Click Next.

5.On the Tables tab, select a table from the list of Available tables. Click Add. The table is added to the list of Selected Tables on the right.

6.On the WHERE Clauses tab, select the table then type the search condition in the lower box.

7.Click Finish.

To create a publication using a WHERE clause (SQL)

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

2.Execute a CREATE PUBLICATION statement that includes the rows you wish to include in the publication and a WHERE condition.

Examples

The following statement creates a publication that publishes the id,

 

company_name, city, and state columns of the customer table, for the

 

customers marked as active in the status column.

 

CREATE PUBLICATION pub_customer (

 

TABLE customer (

 

id,

 

company_name,

 

city,

 

state )

 

WHERE status = ’active’

 

)

 

In this case, the status column is not published. All unpublished rows

 

must have a default value. Otherwise, an error occurs when rows are

 

downloaded for insert from the consolidated database.

96

Page 114
Image 114
Sybase DC38133-01-0902-01 Publishing only some rows using a Where clause, To create a publication using a Where clause SQL