.read would be one way...but this is more direct....

If you have a set of SQL statements in "myfile.sql"  that you want to run on 
"test.db" you can do this:



type myfile.sql | sqlite3 test.db



myfile.sql example between the lines:

====================

create table t(a int);

insert into t values(1);

select * from t;

====================



You could also do

echo .read myfile.sql | sqlite3 test.db





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems

________________________________
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Steffen Mangold [steffen.mang...@balticsd.de]
Sent: Tuesday, November 29, 2011 12:46 PM
To: sqlite-users@sqlite.org
Subject: EXT :[sqlite] Runfile script over existing Database

Hi all,

i have a question. I have a script with edit a database file (insert and alter 
some tables).
Now I want to run this script agains an existing database file, with the 
commandline shell.
How can I do this in a batch file (windows) I don't understand the ".read" 
command.

Regards

Steffen Mangold
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to