DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old June 29th, 2005, 01:44 AM
veeru veeru is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 1 veeru User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 53 sec
Reputation Power: 0
How to find out foriegn key of table in DB2?

How to find out foriegn key of table(DB2)?

Reply With Quote
  #2  
Old July 1st, 2005, 09:02 AM
rbod rbod is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 3 rbod User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 13 sec
Reputation Power: 0
find foreign key

Quote:
Originally Posted by veeru
How to find out foriegn key of table(DB2)?


Different ways you can do this :
1)
select substr(tabname,1,20) table_name,substr(constname,1,20) fk_name,substr(REFTABNAME,1,12) parent_table,substr(refkeyname,1,20) pk_orig_table,fk_colnames from syscat.references where tabname = 'TABLE_NAME'
2)
Use the command :
db2look -d <database_name> -t <table_name> -a -e -c
Look for 'DDL Statements for foreign keys on Table table_name in the output.
3)
Alternatively, If you have access to control center, right click on the table and select 'generate ddl'.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > How to find out foriegn key of table in DB2?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway