referential integrity
Posted in 1999
Topics: Stored Procedures & SPL, Triggers, Constraints & Referential Integrity
hello all, I have the following problem: I have a table in which two records are represensent one information: First the user can store the first record: Keyfield-1 = not empty Keyfield-2 = must empty Keyfield-3 = must empty On later time the user can store the second record (but the first must be present!) Keyfield-1 = value from first record Keyfield-2 = must be filled Keyfield-3 = must be filled I know two table would be easier, but I'm only the db-admin and I will prevent that the users make mistakes! How can I solve this problem with a trigger or stored procedure? Thanks Thomas
Thomas Hartmann wrote: > > hello all, > > I have the following problem: > > I have a table in which two records are represensent one information: > > First the user can store the first record: > > Keyfield-1 = not empty > Keyfield-2 = must empty > Keyfield-3 = must empty > > On later time the user can store the second record (but the first must > be present!) > > Keyfield-1 = value from first record > Keyfield-2 = must be filled > Keyfield-3 = must be filled > > I know two table would be easier, but I'm only the db-admin and I will > prevent > that the users make mistakes! > > How can I solve this problem with a trigger or stored procedure? Add a second table anyway with just the key and make the key to the real table foreign to the "key" table to control the inserts. Art S. Kagel