View Single Post
Old 05-07-2010, 11:25 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,245
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Your constraint is basically saying "the field accid in every record in the Customer table *must* match the field accid in *some* record in the Accounts table."

You can't add the Cutomer record, which needs an *EXITING* accid, until *AFTER* the Accounts record with that accid is added.

In other words, you have the order of your INSERTs backwards. Add to the Accounts table and *THEN* add to the Customer table.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote