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 > create table as select statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-11-05, 10:23
cartjohn cartjohn is offline
Registered User
 
Join Date: Feb 2004
Posts: 5
create table as select statement

Can anyone help me w/ the query below. I am trying to create a table from another table.

SQL:
create table cca8380.testing as select * from card.mktg_cmpgn;
Reply With Quote
  #2 (permalink)  
Old 02-11-05, 10:32
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Have a look into the CREATE TABLE Statement in SQL reference corresponding to your platform, version of your product

Cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 02-11-05, 11:41
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
In Ver 8.1 you can also do CREATE TABLE x like MyTable....

It can do more than "as select *..."

Andy
Reply With Quote
  #4 (permalink)  
Old 02-11-05, 13:37
Tank Tank is offline
Registered User
 
Join Date: Feb 2004
Location: Copenhagen
Posts: 220
Arrow

But usually:

create table x.y as (select statement) definition only

Will work

B.O.W.
__________________
Kristian K. Hansen
Project Supervisor
National Board of Health
Reply With Quote
  #5 (permalink)  
Old 02-11-05, 13:49
achiola achiola is offline
Registered User
 
Join Date: May 2002
Location: General Deheza, Cba, Arg.
Posts: 273
you can copy a table whit the export/import statement, example:

EXPORT TO "E:\PROGRA~1\IBM\SQLLIB\WEBCPTAB.IXF" OF IXF MESSAGES "E:\PROGRA~1\IBM\SQLLIB\WEBCPTAB.EXM" SELECT * FROM DB2DWAD1.A0_2MESESATRAS;

IMPORT FROM "E:\PROGRA~1\IBM\SQLLIB\WEBCPTAB.IXF" OF IXF MESSAGES "E:\PROGRA~1\IBM\SQLLIB\WEBCPTAB.IMM" CREATE INTO DB2INST1.NEWTABLE IN TBATTRIB INDEX IN TBINDEX LONG IN TBLOB;


Quote:
Originally Posted by cartjohn
Can anyone help me w/ the query below. I am trying to create a table from another table.

SQL:
create table cca8380.testing as select * from card.mktg_cmpgn;
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