Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.0 (Français) » SQL Remote » Creating SQL Remote systems » Using disjoint data partitions


Using BEFORE UPDATE triggers

In the following example, three tables store information about the interactions between sales representatives and customers: Customers, Contacts, and SalesReps. Each sales representative sells to several customers. For some customers, there is a single contact, and for other customers there are multiple contacts.

The Contacts table has a foreign key to the Customers table. The Customers table has a foreign key to the SalesReps table.

For detailed descriptions of the tables, see Description of Contacts, Customers, and SalesReps tables.

A sales representative subscribes to a publication that provides a copy of the SalesRep table, a copy of the Customers table with the details of the customers assigned to them, and a copy of the Contacts table with the details of the contacts that correspond to their customers. For example, each sales representative subscribes to the following publication:

   TABLE SalesReps
   TABLE Customers
      SUBSCRIBE BY rep_key
   TABLE Contacts
      SUBSCRIBE BY (SELECT rep_key
         FROM Customers
         WHERE Contacts.cust_key = Customers.cust_key )

For a detailed description of this publication, see Using disjoint data partitions.

 Maintaining referential integrity
 Notes on the trigger