Page 1 of 1

want to fetch tables without parental referencial integrity.

PostPosted: Thu Jan 28, 2010 9:15 pm
by gokulNmf
hi,
i want to get all the tables which dosent have parental referencial integrity but having child referencial integrity, i.e.,
consider a table T1 which has columns T1C1 and T2C2 . consider another another table T2 having column T2C1,T2C2 and T3C3. Now T1 is parent table to T2 and T1 dosent have any parent table, consider that T1C1 is a PK of T1 and T2C2 have FK constrain on T1C1, i.e., we cant insert into T2C2 if the that value is not present in T1C1 :o .
Now i want to get all the such table [T1] from the database ;) , do i have any system tables, so that i can write a query :?: and fetch those tables easily or is there any other methods to list such tables :ugeek: ?

Re: want to fetch tables without parental referencial integrity.

PostPosted: Sat Jan 30, 2010 3:57 pm
by gokulNmf
hi all,
i thought of putting my question in another way as i dint get any reply for 3 days. below is my question.
I have a tables T1 and T2 in the database, T1 has T1.C1, T1.C2 and T1.C3 as columns, in which T1.C1 is the PK, now the table T2 has T1 has T2.C1, T2.C2 and T2.C3 as columns, in which T2.C1 is PK and T2.c2 has referencial integrity in on T1.C1, There are many such table combination is the DB. Now i want to list the table T1 and such other other [i.e., tables which have only child table and doesn't have parent table] from the DB. Is there any System tables so that i can query to get such tables.

Re: want to fetch tables without parental referencial integrity.

PostPosted: Sat Jan 30, 2010 9:30 pm
by dick scherrer
Hello,

Even with th re-post your question is not clear (at least to me<g>).

Show a better example using something "real" rather than Tn, Cn etc. Define what parent and child mean to you.

For example if there is a "people" table and people must work in a department, do you consider one of these the parent? The child?

As a general answer, you can probably find what you want in the db2 catalog tables (if you have permission to access these - not everyone does). Also, speaking with your dba could help.