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 > Informix > Syntax for Create a new table from old table.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-01-07, 04:55
sarwan sarwan is offline
Registered User
 
Join Date: Jun 2006
Posts: 7
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
Reply With Quote
  #2 (permalink)  
Old 11-01-07, 06:17
ceinma ceinma is offline
Registered User
 
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).
________________________________________
Reply With Quote
  #3 (permalink)  
Old 11-01-07, 07:10
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
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;
Reply With Quote
  #4 (permalink)  
Old 11-01-07, 07:33
ceinma ceinma is offline
Registered User
 
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).
________________________________________
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