If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to get the definition of a column and relationship information

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-22-04, 20:37
latticesoft latticesoft is offline
Registered User
 
Join Date: Jun 2004
Posts: 34
How to get the definition of a column and relationship information

Is this possible to get the definition of a column and relationship information in one big query in db2? On the other word, get column's name, data type, scale etc. as well as is this column a foreign key, a primary key, an identity etc. in one query.

I know you can get definition of a column from syscat.column and relationship information from syscat.references, but I want to just use one query to get all these information, I wonder may be somebody already did it.

Thanks in advance for your help,

Kevin

http://www.latticesoft.com
Reply With Quote
  #2 (permalink)  
Old 06-23-04, 13:05
dmmac dmmac is offline
Registered User
 
Join Date: Aug 2003
Location: Massachusetts, USA
Posts: 106
Take a look at sysibm.sqlforeignkeys which is a view that parses the fkcolnames found in sysibm.sysrel (which is used in the syscat.references view). You can then join this view to syscat.columns.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On