Recreate SQL used to define an existing table



IBM's flagship relational database management system

Recreate SQL used to define an existing table

Postby humble » Thu Apr 12, 2012 4:19 pm

Hi, Is it possible to recreate the SQL used to define an existing table?
I need to do this because there is no documentation available on a table defined long ago.
Can I use any QMF options or other tools? please suggest.

I am starting by analyzing the Db2 catalogs.
humble
 
Posts: 9
Joined: Thu Mar 01, 2012 5:01 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Recreate SQL used to define an existing table

 

Re: Recreate SQL used to define an existing table

Postby Akatsukami » Thu Apr 12, 2012 4:47 pm

Start with the following query:
SELECT COLNO, NAME, COLTYPE, LENGTH, NULLS FROM SYSIBM.SYSCOLUMNS
WHERE TBNAME = 'table in question'
ORDER BY COLNO
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1054
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Recreate SQL used to define an existing table

Postby GuyC » Thu Apr 12, 2012 8:43 pm

DataStudio
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post