Importing comma separated data into sqlite

SQLite is world's best self contained transcriptional database engine. This db engine very lite and perfect for portable devices. As it is open source any one can use is on any platform by rebuilding it.

I am using it in my various computer programs.  Many times we have a situation when we have to import raw or existing data into db.

For this sqlite provides import feature which is very efficient to import delimited raw data into table.

For importing raw data in sqlite database it provides set of commands by executing that you can import delimited data.

For example here is sample data

1, sheel, 31
2, shaurya, 3
3, Anupama, 31
and we have to import this into sqlite table, for this

Create a table with same structure and import data into db.
Connect sqlite db file:  sqlite>sqlite3 test.db
Create a table(table1 name): Create Table table1(sr_no int, Name varchar(20), age float);
Set separator : .separator ","
Import Data: .import sample.text table1
.import command is .import [raw data file name] [sqlite table name]
blog comments powered by Disqus