473,320 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to retrieve FK reference infomation

Hi,

Please find me with this, I don't which IBM sys table to query.

I am using DB2 7.1 in OS390. I need to retrieve the FK reference
information, i.e., which PK column a FK is refer to? I tried SYSRELS
table, but it only gives me the reference/parent table information.
Thanks lot!

Nov 12 '05 #1
3 4981
Does the syscat.references table help u in what ur looking for?

Nov 12 '05 #2
select FK.CREATOR, FK.TBNAME, FK.COLNAME, FK.COLSEQ, PK.TBCREATOR,
PK.TBNAME, PK.NAME, R.RELNAME
from SYSIBM.SYSRELS R,
SYSIBM.SYSFOREIGNKEYS FK,
SYSIBM.SYSCOLUMNS PK
where R.CREATOR= ?
and R.TBNAME= ?
and R.RELNAME = FK.RELNAME
and R.CREATOR=FK.CREATOR
and R.TBNAME=FK.TBNAME
and R.REFTBCREATOR=PK.TBCREATOR
and R.REFTBNAME=PK.TBNAME
and FK.COLSEQ=PK.KEYSEQ
ORDER BY R.RELNAME, FK.COLSEQ asc

Yury Jhol
Chief Systems Architect
www.ispirer.com
<fo********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Hi,

Please find me with this, I don't which IBM sys table to query.

I am using DB2 7.1 in OS390. I need to retrieve the FK reference
information, i.e., which PK column a FK is refer to? I tried SYSRELS
table, but it only gives me the reference/parent table information.
Thanks lot!

Nov 12 '05 #3
This works, Thanks a lot!

Yury Jhol wrote:
select FK.CREATOR, FK.TBNAME, FK.COLNAME, FK.COLSEQ, PK.TBCREATOR,
PK.TBNAME, PK.NAME, R.RELNAME
from SYSIBM.SYSRELS R,
SYSIBM.SYSFOREIGNKEYS FK,
SYSIBM.SYSCOLUMNS PK
where R.CREATOR= ?
and R.TBNAME= ?
and R.RELNAME = FK.RELNAME
and R.CREATOR=FK.CREATOR
and R.TBNAME=FK.TBNAME
and R.REFTBCREATOR=PK.TBCREATOR
and R.REFTBNAME=PK.TBNAME
and FK.COLSEQ=PK.KEYSEQ
ORDER BY R.RELNAME, FK.COLSEQ asc

Yury Jhol
Chief Systems Architect
www.ispirer.com
<fo********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Hi,

Please find me with this, I don't which IBM sys table to query.

I am using DB2 7.1 in OS390. I need to retrieve the FK reference
information, i.e., which PK column a FK is refer to? I tried SYSRELS table, but it only gives me the reference/parent table information.
Thanks lot!


Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: David Rasmussen | last post by:
Some sites seem to be session driven in the sense that if I visit the homepage and do a few clicks I can navigate anywhere I want, but if I paste the current location into a new browser window...
4
by: Jerry Orr | last post by:
I am attempting to retrieve various MVS dataset allocation parameters (lrecl, block size, etc) from a C/C++ program. The C/C++ Run-time Library Reference states that the function svc99() can be...
1
by: Zeng Dinghao | last post by:
I encouter this problem. here are the sample files: //--------------- File: Bar.h ------------------------------ class Bar : public BarBase { public: void BarFunc(); // there is no BarFunc in...
2
by: mafro | last post by:
I have made an expression through the expression buider for a macro. The program cant find the infomation contained within the table when the process is run. I know the infomation is in the table...
6
by: tham | last post by:
hi Is a reference a special type in C#. For example when i d MyClass aRef what are the classes that are available that i can use to probe aRef as a reference. My real goal is to make a...
4
by: kevincw01 | last post by:
Anyone have a clever way to retrieve for example, items 0-29 from an array of size N>29, in random order? The catch is that I dont want to print any items more than once and I dont want to miss...
3
by: Gurpreet22 | last post by:
I have designed a web form, which has a drop down list. What i would like to do is when a user selects a value from the drop down list and submits the form, the user is redirected to the next page,...
2
by: shantanu | last post by:
Dear All I need to do a implementation in c#. The requirement is like i have to retrieve the information of the installer , like version and compare it with the version of the new installer.How...
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.