View previous topic :: View next topic
|
Author |
Message |
bipinpeter
Active User
Joined: 18 Jun 2007 Posts: 213 Location: Cochin/Kerala/India
|
|
|
|
Hi All,
Is any way to get the parent table of one particulare table.What query i need to execute to get this?
Regards,
Bipin Peter |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quite often a parent/child relationship is logical rather than a physical link (as was done in non-relational systems).
I don't know of a way to guarantee discovery of all possible parent/child relationships via a query.
Depending on how your database was designed, there may be a logical data model available in some case tool that will show these relatonships. |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Hi Pete,
Check out this LINK
Change the WHERE clause condition to A.TBNAME='youchildtablename'
Sushanth |
|
Back to top |
|
|
bipinpeter
Active User
Joined: 18 Jun 2007 Posts: 213 Location: Cochin/Kerala/India
|
|
|
|
Thanks alot sushanth ,It work fine..
Bipin Peter |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
With the exception that it will probably not detect all child tables. . . As i mentioned before, many parent/child relatonships are not so "formally" established in the meta-data.
If the query provides everything you need, great, but do be aware that there may be other p/c relationships that it cannot identify. |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Hi d.sch,
Quote: |
be aware that there may be other p/c relationships that it cannot identify. |
Can you tell me scenario where it cannot identify.
Because, if tables are created as stand-alone tables, i.e., with no relationships with other tables.
The next Only way is to logically relate them in the program. By this method we cannot identify P/C from the catalogs.
Sushanth |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
The next Only way is to logically relate them in the program. By this method we cannot identify P/C from the catalogs. |
Exactly . Many, many older systems were designed for non-relational technology and when they were converted/migrated to a relatoinal dbms (db2, for example), they were not redefined. The code already "knew" how to enforce relationship rules and continued to do so in the "new" database environment.
This is why i mentioned looking for an external "picture" of the database.
Unless one is working with a database structure that they completely designed/implemented, one should not depend on the structure containing all of the necessary information. Many (actually most, in my experienc) older databases were not completely re-vamped when they were converted to newer database software. |
|
Back to top |
|
|
|