On Tue, 14 Nov 2006 23:44:12 -0000, you wrote:

>Have figure out now what the quickest way is to move data from Interbase to
>a SQLite db file:
>IB to ADO recordset
>Recordset to text
>Import the text file with the .import command.
>
>Now I am trying to figure out how to automate the last step with a .bat
>file.
>What I got sofar is:
>Have a SQL file with:
>
>create table ReadCode
>  (
>    SUBJECT_TYPE           varchar(5),
>    READ_CODE           varchar(5),
>    TERM30           varchar(30),
>    TERM60       varchar(60)
>  );
>
>Run a .bat file with this:
>
>cd C:\SQLite
>del ReadCode.db
>type ReadCode.sql | sqlite3 ReadCode.db
>
>Then run from the command prompt:
>
>Cd C:\SQLite  (press return)
>SQLite3 ReadCode.db  (press return)
>.mode csv    (press return)
>.import ReadCode.txt ReadCode   (press return)
>
>This runs nice and quick, but how would I combine all this in one .bat file
>or how could I run this all from VB? I know very little about .bat files,
>but I would think that somehow it must be possible.
>Thanks for any assistance.
>
>
>RBS

Input scripts for the sqlite command line utility aren't
restricted to SQL, you can also put 'dot commands' in it.

Try this (some day you may be working on an existing
database instead of deleting it first, so I would drop the table
first):

--- file ReadCode.sql begin  ---
drop table if exists ReadCode;
create table ReadCode (
  SUBJECT_TYPE varchar(5),
  READ_CODE    varchar(5),
  TERM30       varchar(30),
  TERM60       varchar(60)
);
.mode csv
.import ReadCode.txt ReadCode
--- file ReadCode.sql end ---

And this is your shell script:
--- file ReadCode.bat begin ---
cd  C:\SQLite
del ReadCode.db
SQLite3 ReadCode.db <ReadCode.sql
--- file ReadCode.bat end ---

That's all (untested)

Notes:
``<filename`` means input redirection.
It does the same as ``type filename |`` , but with
less overhead. 
By the way, where's your primary key?

Hope this helps,
-- 
  (  Kees Nuyt
  )
c[_]

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to