On 8/21/07, Preston, Brian <[EMAIL PROTECTED]> wrote:

<<snip>>


> Does anyone have an example of doing an import from a .sql file into an
> existing sqlite3 db?  I've tried:
>
> sqlite3 .import <pathToSQLFile> <pathToDB>
>
> sqlite3 .import <pathToSQLFile> | <pathToDB>
>
> sqlite3 <pathToSQLFile> <pathToDB> .import
>
> sqlite3 <pathToSQLFile> | <pathToDB> .import
>
> and various other permutations.  It usually give me an error saying
> 'syntax error at' the start of my <pathToSQLFile>


<<snip>>

I'm assuming you're including the greater/less than signs in the above
commands.  These have special significance to the command shell and should
be omitted.  Also, you've reversed the parameters, so assuming that your
using your C: drive, your database is named TEST.DB in a directory called
DATABASE, and that your datafile is called INPUTDATA.SQL in a directory
called DATA, the command should look like:

sqlite3 C:\DATABASE\TEST.DB < C:\DATA\INPUTDATA.SQL

According to what I read, the .dump command includes both the DDL to create
your database schema as well as the data within the tables.  I don't have my
database far enough along to confirm this.

>From reading your message, it appears that you're not familiar with working
at the command line (in your example, it seems your confusing what commands
are available at the command line, and what commands are available once
you've invoked the sqlite3 utility).  I think it would be beneficial if you
read up on the subject on Google, or located a book on the subject.
O'Reilly books has an excellent book on the NT command shell, which hasn't
changed since that release, so it will still apply no matter what Windows OS
you're using.

Reply via email to