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 > find out identity,primary key etc.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-14-05, 14:08
udbdb2 udbdb2 is offline
Registered User
 
Join Date: Nov 2003
Posts: 121
find out identity,primary key etc.

Is there any quickest way or command to find out

1.Identity column in a table

2.Primary key column and keys

3.Ref. Integrity/foreign Key

TIA.
Reply With Quote
  #2 (permalink)  
Old 02-14-05, 14:33
quigleyd quigleyd is offline
Registered User
 
Join Date: Nov 2002
Location: Delaware
Posts: 186
Run the db2look against the table and it will give you everything you need, look at the options to get what you need in the output
__________________
David Quigley
Reply With Quote
  #3 (permalink)  
Old 02-14-05, 15:55
fohana fohana is offline
Registered User
 
Join Date: Jan 2005
Location: Rio de Janeiro - Brazil
Posts: 28
Another option

Instead of running the DB2LOOK utility you can just run queries against the catalog views to gather the information you want.

I´d suggest you pay a visit to the SQL References to for a description about those views (SYSCAT schema).

For a start, according to the information you requested, take a look at the: SYSCAT.TABLES, SYSCAT.COLUMNS, SYSCAT.INDEXES, SYSCAT.REFERENCES, SYSCAT.TABCONST.

Depending on what you´re trying to do, it´ll have a better result than the DB2LOOK utility.

Now, if you just want to get the DDL statements to backup the structure, or copy it to another location, I strongly recommend using the DB2LOOK.

Hope it helps.
Fernando
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