Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OpenSQL INSERT Subquery

Former Member
0 Likes
606

I'm looking to copy all records from one table and insert them into another identical table. I get the impression that this could be acheived using INSERT and a subquery SELECT but I can't seem to grasp it?

Any help would be much appreciated.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
533

If you are trying to do something like:

insert into ztab1 from 
  select * from ztab2.

I don't think this can be done in open SQL.

Rob

3 REPLIES 3
Read only

ThomasZloch
Active Contributor
0 Likes
533

I have never heard that this could be done with just one open SQL statement (but that doesn't mean much).

I would select from one table into an internal table and insert that into the other one, using block processing in case the number of records is too large.

Probably an easier task if done directly down at the database level via native SQL.

Thomas

Read only

Former Member
0 Likes
534

If you are trying to do something like:

insert into ztab1 from 
  select * from ztab2.

I don't think this can be done in open SQL.

Rob

Read only

Former Member
0 Likes
533

To copy all the contents of one table into another identical table,we need to something like this.

select * from dbtab into correponding fileds of table itab.

Regards

Abhinab.