On 06 Mar 2013 07:21, Michael Ryan wrote:
I need to insert corresponding columns from TableB into TableA.
TableB has more columns than TableA. All the rows will be inserted.
I need the equivalent of CPYF FMTOPT(*MAP *DROP). I don't want to
specify all the column names if I don't have to. Any ideas?
Given the specific DDL for a scenario [i.e. a specific TableA and
TableB], there might be an acceptable option to perform effectively what
is desired, without using a column-list specification.
However generically, the SQL INSERT is not conducive to effect the
FMTOPT(*MAP) because the data is inserted by column positions rather
than by column names; and no option to override that behavior :-(
Probably the best bet to accomplish that generically, is to write a
program that uses dynamic SQL [as stored procedure] to build the
statement to do [or perhaps to create a VIEW to enable] the insert.