referenced records

referenced records

Post by mpw » Thu, 10 Jul 2003 06:56:08



When I do a select on a record, is there a way that I can tell if it is
being referenced by another table, and if so, can I tell by what table?
 
 
 

referenced records

Post by Art S. Kage » Thu, 10 Jul 2003 09:02:38



> When I do a select on a record, is there a way that I can tell if it is
> being referenced by another table, and if so, can I tell by what table?

The system catalog table, sysreferences, will tell you if the TABLE is
referenced in foreign key constraints by any other tables and by
following the chain of constraint ids you can determine which table(s)
is/are referencing this one.  Once you've done that you can query the
referencing table to determine if there are actually any records that
refer the a particular record's key (the foreign key constraint
definition will tell you the name of the referencing field(s) in the
other table).

Art S. Kagel

 
 
 

referenced records

Post by Colin Bul » Thu, 10 Jul 2003 16:34:15


If there is a foreign key constraint, you can check on that in the sysmaster
database.

 mpw wrote

Quote:

> When I do a select on a record, is there a way that I can
> tell if it is
> being referenced by another table, and if so, can I tell by
> what table?

Colin Bull

sending to informix-list

 
 
 

1. howto determine whether a record is still referenced

I have a central piece of information which is referenced from many
different tables. Now when someone wants to delete a record of this central
table I'd like to check beforehand whether this record is still referenced
by any of the other tables. Doing a count(*) on all these other tables would
be somewhat tedioius and error-prone because if antoher table will be added
sometime which would use this central information, too, there's a big chance
that at some time I'd forget to add the checking.

So, is there a way to determine whether a record is still referenced by any
foreign key anywhere (in the same database)?

TIA
Rudi

2. Editor Out of Memory

3. ASP query returning zero records from reference tables

4. AutoNumber column and ADO

5. Updating references when deleting records.

6. Please Let me know where is the examples for Dynamic SQL in ver6.5

7. Deleting files referenced by database records??

8. Windows 98 and MSJET35.DLL

9. Retrieve index/reference/ID from a new record

10. Passing Table Record by Reference

11. Syntax to reference next record

12. Record locking reference in access

13. can'nt reference table declared from record type