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 > ddl exctract using sql/pl

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-14-07, 14:59
baloo99 baloo99 is offline
Registered User
 
Join Date: Feb 2007
Location: Bratislava, Slovakia
Posts: 85
ddl exctract using sql/pl

Hi all,
please exists any way how to extract ddl for table in procedure?
thanks,
Ondrej
Reply With Quote
  #2 (permalink)  
Old 05-14-07, 16:08
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
If you mean the CREATE TABLE statement, no.

Andy
Reply With Quote
  #3 (permalink)  
Old 05-14-07, 16:14
baloo99 baloo99 is offline
Registered User
 
Join Date: Feb 2007
Location: Bratislava, Slovakia
Posts: 85
ARWinner: yes, I mean create table... statement
thanks
Reply With Quote
  #4 (permalink)  
Old 05-14-07, 16:25
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
What do are you trying to do?

Andy
Reply With Quote
  #5 (permalink)  
Old 05-14-07, 16:59
baloo99 baloo99 is offline
Registered User
 
Join Date: Feb 2007
Location: Bratislava, Slovakia
Posts: 85
I trying move table into another tablespace. (from SMS to DMS). I like use altobj procedure in my procedure for move table. when i drop original table, then cascade are dropped referential constraints... altobj is good method, but i need original ddl "create table " extract from database. Excuse my poor english.
Reply With Quote
  #6 (permalink)  
Old 05-15-07, 08:35
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
The actual CREATE TABLE statement does not reside anywhere within the database. Probably because any subsequent ALTER TABLE statements would render it useless.

However, the DDL to create the table in its current format along with all triggers, indexes, and RI can be generated from the catalog (syscat-tables, columns, etc). This is how the ALTOBJ procedure and the Control Center genenerates the statements.

I am assuming you want this new stored procedure so that you can change lots of tables. Probably the simplest and easiest way to do this would be to use db2look to generate a script of the tables you want to move to another tablespace. Then edit the script to encapsulate the CREATE TABLE statements with calls to ALTOBJ.

Andy
Reply With Quote
  #7 (permalink)  
Old 05-15-07, 19:04
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #8 (permalink)  
Old 05-17-07, 07:45
baloo99 baloo99 is offline
Registered User
 
Join Date: Feb 2007
Location: Bratislava, Slovakia
Posts: 85
Sathyaram_s, ARWinner: thanks for help
Ondrej
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