On Wed, 17 Dec 2008 06:38:29 -0800 (PST), Rachmat Febfauza
<[email protected]> wrote in General Discussion of SQLite
Database <[email protected]>:

>how to do load infile and into outfile like mysql does in sqlite?

== Export ==========================
C:\yourdir> sqlite3 yourdatabase
SQLite version 3.6.7
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .header off
sqlite> .mode csv
sqlite> .output data1.csv
sqlite> SELECT * FROM table1;
sqlite> .output data2.csv
sqlite> SELECT * FROM table2;
sqlite> .output stdout
sqlite> .quit
C:\yourdir>
====================================

== Import ==========================
C:\yourdir> sqlite3 yourdatabase
SQLite version 3.6.7
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
-- create and import
sqlite> CREATE TABLE table1 (.........);
sqlite> CREATE TABLE table2 (.........);
sqlite> .import data1.csv table1
sqlite> .import data2.csv table2
sqlite> .quit
C:\yourdir>
====================================

== Backup ==========================
C:\yourdir> sqlite3 yourdatabase .dump >dump.sql
====================================

== Restore =========================
C:\yourdir> sqlite3 newdatabase <dump.sql
== or ==============================
C:\yourdir> sqlite3 newdatabase
sqlte> .read dump.sql
sqlte> .quit
====================================

>thanks

Hope this helps.
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to