Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2006
    Posts
    7

    Unanswered: Syntax for Create a new table from old table.

    Hi All,
    I need to create a new table from already existing table. I tried the following syntax, but it doesn't work.

    create table new_table as select * from old_table;
    create table new_table like old_table;

    Thanks
    Sarwan

  2. #2
    Join Date
    Apr 2007
    Location
    Jundiai / SP - Brasil
    Posts
    311
    Informix do not have this syntax...
    you must execute a dbschema -d <database> -t <table> <-ss>
    and alter the table name...
    ________________________________________
    César Inacio Martins
    Jundiai / SP - Brasil
    http://www.imartins.com.br/informix - em Português
    http://www.imartins.com.br/informix - English (translated by Google).
    ________________________________________

  3. #3
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Quote Originally Posted by sarwan
    Hi All,
    I need to create a new table from already existing table. I tried the following syntax, but it doesn't work.
    I am not a regular Informix user, but I think the following should work:
    Code:
    select * from old_table into new_table;

  4. #4
    Join Date
    Apr 2007
    Location
    Jundiai / SP - Brasil
    Posts
    311
    the correct syntax is :
    select * from old_table into TEMP new_table

    and this way you will create just a temporary table...
    unfortunately must use the dbschema to do this job...
    ________________________________________
    César Inacio Martins
    Jundiai / SP - Brasil
    http://www.imartins.com.br/informix - em Português
    http://www.imartins.com.br/informix - English (translated by Google).
    ________________________________________

  5. #5
    Join Date
    May 2013
    Posts
    1
    Quote Originally Posted by ceinma View Post
    Informix do not have this syntax...
    you must execute a dbschema -d <database> -t <table> <-ss>
    and alter the table name...

    Now it does! As of Informix version 12.10 we support this syntax for permanent tables:

    create table tab2 as select * from tab1;

Posting Permissions

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