Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2007
    Location
    Bratislava, Slovakia
    Posts
    85

    Unanswered: ddl exctract using sql/pl

    Hi all,
    please exists any way how to extract ddl for table in procedure?
    thanks,
    Ondrej

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    If you mean the CREATE TABLE statement, no.

    Andy

  3. #3
    Join Date
    Feb 2007
    Location
    Bratislava, Slovakia
    Posts
    85
    ARWinner: yes, I mean create table... statement
    thanks

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    What do are you trying to do?

    Andy

  5. #5
    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.

  6. #6
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

  7. #7
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  8. #8
    Join Date
    Feb 2007
    Location
    Bratislava, Slovakia
    Posts
    85
    Sathyaram_s, ARWinner: thanks for help
    Ondrej

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •