Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

two table fields names

Status
Not open for further replies.

patweb

Programmer
Apr 17, 2003
174
0
0
BE
I have the next barrier :

tbl format description

formatfieldname - 01_SUP (value of this field)
- 02_DES (value of this field)
- 03_NED (value of this field)
formatfieldrequired

tbl import
01_SUP (field)
02_DES (field)
03_NED (field)

Exactly the same names, but in one table there a values in the field formatfieldname en in the other they are fields.

With an sql I need to link them (where condition) to get the value of the field formatfieldrequired. Is this possible ?

 
Let me see if I understand the situation.

One table, I will call it FormatDescriptions, has two columns. One column is named formatfieldname, another is named formatfieldrequired. The column formatfieldname has values such as 01_SUP, 02_DES,and 03_NED which are the names of columns in another table, or possibly many other tables. The other column, formatfieldrequired, has values which tell how to format the data for the various columns.

There is another table named ImportedData with columns named 01_SUP, 02_DES,and 03_NED.

I dont see how the data in the table named ImportedData has any relationship to the data in the table named FormatDescriptions. I am using the word relationship to mean a link.

FormatDescriptions is like a data dictionary, it tells us about the data. But it is not part of the data and cannot be linked to the data.

Perhaps you could tell us more about what you are trying to do.



BTW, I like to use the words rows and columns when I am talking about SQL tables.


 
if you have a table called tbl_import,
how about something like this:

select formatfieldrequired
from formatdescription a, syscat.columns b
where a.formatfieldname = b.colname
and b.tabname=upper('tbl_import')

in syscat.columns you can find all the columns for tables, usually in upper characters. But this you can check.


Juliane
 
uuups, I answered for DB2. since you need access to your dbms internal catalog, you should post your question in your dbms specific formum, sorry.
in every dbms there is some table where you can find the information about table columns ...


Juliane
 
every dbms there is some table where you can find the information about table columns
and in most of them, you can get it from the standard INFORMATION_SCHEMA views

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top