Contents Index The Policy example Territory realignment with a many-to-many relationship

SQL Remote User's Guide
  SQL Remote Design for Adaptive Server Anywhere
    Sharing rows among several subscriptions
      The Policy example

The publication

A single publication provides the basis for the data sharing:

CREATE PUBLICATION SalesRepData (
   TABLE SalesRep,
   TABLE Policy SUBSCRIBE BY rep_key,
   TABLE Customer SUBSCRIBE BY (
      SELECT rep_key FROM Policy
      WHERE Policy.cust_key =
         Customer.cust_key
   ),
);

The subscription statements are exactly as in the previous example.

How the publication works 

The publication includes part or all of each of the three tables. To understand how the publication works, it helps to look at each article in turn:

Multiple-valued subqueries in publications 

The subquery in the Customer article returns a single column (rep_key) in its result set, but may return multiple rows, corresponding to all those sales 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.


Contents Index The Policy example Territory realignment with a many-to-many relationship