Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create table with data from subquery

Status
Not open for further replies.

new2db2

MIS
Oct 17, 2002
5
0
0
US
Hey everyone,
How can I create a table with a subquery that contains the structre of the query and the data? In other DBMS systems, like Teradata, I would use something like "with data" in place of "definition only". Is this possible in DB2? Thanks in advance.

The below code only creates an empty table, which is expected with the definition only parameter. I am having no success finding the include data patameter.

create table test as (select * from other table) definition only;
 
new2db2,

I haven't managed to get it working in DB2. Used it in other DBMS's no problem. I ended up doing the following

drop table asn.copy_captrace;
create table asn.copy_captrace like asn.ibmsnap_captrace;
insert into asn.copy_captrace select * from asn.ibmsnap_captrace;

Cheers
Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top