I need to mass populate my SQLite database — ideally using a script rather than code.
I would like to do this (MySQL syntax) but for SQLite but I’m not sure it you can have variables defined in scripts:
INSERT INTO `parent` (id, name) values(NULL, "some name!");
SET @parentId= last_insert_rowid();
INSERT INTO `child` (id, parentId, name, ) values (NULL, @parentId, 'some name!);
SQLite throws errors when I try to declare variables in my SQLite script. Can this be done in SQLite?
Unfortunately you can’t declare such variable in SQLite script. Moreover AFAIK all statements will not be executed except the first one. Also look HERE