Hi Michael,
the statement should look like this:
insert into table2 (col1, col2)
select col1, col2
from table1;
The VALUES clause is only used, when you want to insert values from a list.
insert into table2 (col1, col2)
values (
(1, 2), -- 1st row with 2 values
(3, 4), -- 2nd row ...
(5, 6) -- 3rd row ...
);
HTH
Daniel
------------------------------
Daniel Gross
#IBMChampion
Senior Core Developer, Geis Group
Pegnitz, Germany
https://blog.qpgmr.de/------------------------------
Original Message:
Sent: Tue September 16, 2025 02:13 PM
From: Michael Cramer
Subject: insert with subselect error SQL0412
Hi,
why is this statement posting error:
. : SQL0412 Severity . . . . . . . : 30
. : Diagnostic
Subselect with more than one result column not valid.
insert into table2 (col1, col2)
values
( select col1, col2
from table1
) ;
------------------------------
Michael Cramer
------------------------------