want to fetch tables without parental referencial integrity.



IBM's flagship relational database management system

want to fetch tables without parental referencial integrity.

Postby gokulNmf » Thu Jan 28, 2010 9:15 pm

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: ?
Cheers,
Gokul
User avatar
gokulNmf
 
Posts: 114
Joined: Sat Mar 28, 2009 6:41 pm
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: want to fetch tables without parental referencial integrity.

 

Re: want to fetch tables without parental referencial integrity.

Postby gokulNmf » Sat Jan 30, 2010 3:57 pm

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.
Cheers,
Gokul
User avatar
gokulNmf
 
Posts: 114
Joined: Sat Mar 28, 2009 6:41 pm
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: want to fetch tables without parental referencial integrity.

Postby dick scherrer » Sat Jan 30, 2010 9:30 pm

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post