For a load test I have to copy a row in my table in a sqlite database 1000 (5000, 10000) times. With the statement
INSERT INTO MYTABLE (
created,
modified,
anotherfield,
etc
)
SELECT created,
modified,
anotherfield,
etc FROM MYTABLE WHERE id = 1;
I can copy it one time. But it would be great to be able to put this into a loop to execute this statement n times.
It seems like SQLite does not support for-loops. I found something called WITH RECURSIVE which could be something like the SQLite way to handle loops. But if I execute
WITH RECURSIVE
cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1000)
<insert_statement_from_above>
the insert statement gets executed only once. What am I doing wrong? How can I get to insert 1000 (5000, 10000) rows without having to add them all one by one? Thanks!