Chapter 7. SQL Remote Design for Adaptive Server Anywhere

...

TABLE Policy

SUBSCRIBE BY rep_key,

...

The subscription expression ensures that each sales rep receives only those rows of the table for which the value of the rep_key column matches the value provided in the subscription.

The Policy table partitioning is disjoint: there are no rows that are shared with more than one subscriber.

Customer table A subscription expression with a subquery is used to define the partition. The article is defined as follows:

...

TABLE Customer SUBSCRIBE BY ( SELECT rep_key

FROM Policy

WHERE Policy.cust_key =

 

Customer.cust_key

 

),

 

...

 

The Customer partitioning is non-disjoint: some rows are shared with

 

more than one subscriber.

Multiple-valued

The subquery in the Customer article returns a single column (rep_key) in

subqueries in

its result set, but may return multiple rows, corresponding to all those sales

publications

representatives that deal with the particular customer. When a subscription

 

expression has multiple values, the row is replicated to all subscribers whose

 

subscription matches any of the values. It is this ability to have

 

multiple-valued subscription expressions that allows non-disjoint

 

partitionings of a table.

Territory realignment with a many-to-many relationship

 

The problem of territory realignment (reassigning rows among subscribers)

 

requires special attention, just as in the section “Territory realignment in the

 

Contact example” on page 107 .

 

You need to write triggers to maintain proper data throughout the installation

 

when territory realignment (reassignment of rows among subscribers) is

 

allowed.

How customers are

In this example, we require that a customer transfer be achieved by deleting

transferred

and inserting rows in the Policy table.

To cancel a sales relationship between a customer and a sales representative, a row in the Policy table is deleted. In this case, the Policy table change is properly replicated to the sales representative, and the row no longer appears

115

Page 133
Image 133
Sybase DC38133-01-0902-01 manual Territory realignment with a many-to-many relationship, Contact example on