PrintLogo

Importing a CSV file to a SQLite Database




SQLite has a build in import command for importing records from text files. We used a tab for a field separator:

$ sqlite3 database.db
SQLite version 3.1.3
Enter ".help" for instructions
sqlite> .separator "\t"

Now that we have set our field separator, we can import:

sqlite> .import ex.txt tablename
sqlite> 





This article comes from NetAdminTools:
http://www.netadmintools.com/

The URL for this story is:
http://www.netadmintools.com/art572.html

Copyright 1997-2008 NetAdminTools.com. Read our Terms of Use.