http://www.perlmonks.org?node_id=995080


in reply to dynamic bulk insert in sqlite

Assuming there is a header line: just chop off the first line (the header line) and split that into an array. With that array, build a create table statement (it's often necessary to sanitize the column names), and send it to SQLite. After that, just send the whole file *except* the first line.

If there is no headerline, generating the column-names + create table statement is obviously even easier.

(The whole procedure is not SQLite specific either, the bulk loader used will differ per DBMS)