For a project I want to use a query to insert multiple rows into a table. I found several threads on how to do this, for example this one, that were really helpful but I still can't figure it out how to insert multiple rows.
The SQL code that I currently have doesn't cause any syntax error, but it just doesn't insert any rows.
My table that I want to insert into looks like:
create table SYT_ABRDAT
(
id integer primary key not null,
beginper integer,
eindper integer,
periode text,
groep bit
)
The query that I'm currently using (I made it shorter):
insert into syt_abrdat (id, begindat, einddat, periode, groep)
select *
from
(select top 1
"1" as id, "9999" as begindat, "9999" as einddat,
"---" as periode, "1" as groep
from
onerow
union all
select top 1
"2" as id, "9999" as begindat, "9999" as einddat,
"XXX" as periode, "1" as groep
from
onerow
)
Solution:
I added an empty row into table onerow
instead of filling it with some data.
This is necessary