lundi 7 septembre 2015

How to read a .txt file line by line with a SQLite script ?

I am working on a project with a database. This database is very simple. There is only one table with 2 columns : id (int) and text (string). To fill this base I want to create a script file.

I want my script to create the table and then read a .txt file with a string value (for text column) on each row. For each row, it should insert the string value into the table.

I am not very familiar with SQLite and SQL in general. I already found a way to auto-increment the id using an iterator (but I dind't test it yet), but I couldn't found how to read a .txt file line by line.

  • So my question is : Is it possible to read a .txt file line by line in a SQLite script ?

  • And if it is, could you please tell me how to do it.

Aucun commentaire:

Enregistrer un commentaire