referential integrity

referential integrity

Post by Thomas Hartman » Sun, 31 Dec 1899 09:00:00



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

 
 
 

referential integrity

Post by Art S. Kage » Sun, 31 Dec 1899 09:00:00



> 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

 
 
 

1. declarative referential integrity (DRI)

From BOL, I understand that DRI permissions means the
following:

Grant, revoke, or deny declarative referential integrity
permissions on thisobject

What I don't understand is exactly how setting this
permission affects any table access.  Would someone be
kind enough to show me an example that demonstrates how
setting the DRI permission to grants, revoke, or denies
affects user access?  I've tried a couple of different
tests, but haven't been able to determine how this setting
affects any access.

2. How do I programmatically create a PRIMARY KEY?

3. Referential Integrity and Version Control

4. SQL Server DOWNGRADE

5. Referential integrity on commit in SQL 2000?

6. Ingres error e_op0004 and e_rd0002

7. setting referential integrity in sql 7.0

8. performance monitoring - cache hit rates

9. Referential Integrity VS Cascade Deletes

10. Declarative Referential Integrity and SQL 7

11. Referential Integrity and Triggers help

12. Referential Integrity

13. Newbie: Help on Referential Integrity via FK when creating a table