Referential Integrity Constraints

Referential integrity preserves the relationship between tables when you are adding or deleting records. Enforced referential integrity prevents you from adding a record to or deleting a record from a related table if there is no corresponding record in the primary table. In some situations, enforced referential integrity might result in synchronization errors. For example, if a user deletes a record in the Design Master that has a primary key and another user inserts a record in a replica that references that key, the next synchronization of the two members generates two errors. During synchronization, Microsoft Jet attempts to delete the primary key record in the replica but cannot. The reference to a record or records in a related table in the replica prevents the deletion from succeeding. Microsoft Jet also attempts to add the referencing record in the Design Master but cannot because the new record references a primary key that no longer exists in the Design Master. To correct the two errors, you must delete from the replica the record that references the deleted primary key.

The outcome of the preceding scenario changes if you enforce cascading deletes in your application. With cascading deletes in effect, Microsoft Jet deletes both the primary key record and all referencing records in the Design Master. When the Design Master is synchronized with the replica, the referencing record fails to synchronize because there is no longer a valid primary key; Microsoft Jet records the error in the MSysErrors table. In this situation, however, the error will correct itself during the next synchronization when the replica is notified that the primary key has been deleted from the record.