On 9 Dec 2010, at 9:58am, yazdan asgari wrote: > I want to write a program in order to insert data to a sqlite database from a > text file. The text file contains data in each line as below which repeats > about 200 lines: > > P05075 > 01-JAN-1988 > 16 > TOBACCO RATTLE VIRUS (STRAIN PSG). > CORNELISSEN B.J.C., LINTHORST H.J.M., BREDERODE F.T., BOL J.F.; > NUCL. ACIDS RES. 14:2157-2169(1986). > 141 > 16297 > 93420 > MTCVLKGCVNEVTVLGHETCSIGHANKLRKQVADMVGVTRRCAENNCGWFVCIIINDFTFDVYNCCGRSHLEKCRKRVEARNREIWKQIRRIQAESSSATRKKSHNSKNSKKKFKEDREFGAPKRFLRDDVPLGIDQLFVF > ... > > > I want to read this file and insert each line into a value of a database > (database contains 3 tables). I can write a code to read text file but I do > not know how to insert these data to sqlite tables during reading process. > Could any one suggest me a simple program to do this?
Just use the INSERT command, which is part of the SQL standard. http://www.sqlite.org/lang_insert.html How to access SQLite from your programming language depends on what programming language you're using. If Google doesn't find anything helpful for you, tell us what language you're using and we might be able to help. However, if you are doing this once only, to get your database started, it will be simpler to convert your text file to .csv format, and use the SQLite command-line tool to make a table out of it. http://www.sqlite.org/sqlite.html Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users