Import text file into sqlite

Peter Haworth pete at lcsql.com
Tue Jun 3 12:20:02 EDT 2014


First thing to do is get a copy of Alex Tweedly's excellent handler for
unpacking csv files.

After that, a lot depends on the structure of your database versus the
structure of the csv file but in general you just need to create a SQL
INSERT statement for each line in the csv file (except the heading line).
 Also, issue a BEGIN statement before the first INSERT and a COMMIT after
the last INSERT, plus a ROLLBACK if any errors occur during the INSERT loop.

If this is a one-off exercise rather than something a user has to do
regularly, take a look at my SQLiteAdmin program which will do all this for
you.

Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>


On Mon, Jun 2, 2014 at 8:06 PM, Magicgate Software - Skip Kimpel <
skip at magicgate.com> wrote:

> Good evening everybody,
>
> I have a text file that I need to import into a sqlite file.  I have a
> script that will create the sqlite file, however I am struggling with the
> rest of the coding.
>
> The text files comes with file headers that I can use, if I choose to.
>
> Any help is greatly appreciated!
>
> SKIP
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list