Kees,

How would I run these 4 commands via a .bat file or via whatever means:

cd c:\test\ReadCodes
c:\test\Program\sqlite3 c:\test\ReadCodes\ReadCode.db"
.output testfile.txt
select * from readcode where read_code glob 'G2*';

It must be simple, but I can't see it.

RBS

-----Original Message-----
From: Kees Nuyt [mailto:[EMAIL PROTECTED] 
Sent: 16 November 2006 21:36
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] select from commandprompt with output to file


Hi RBS,

On Thu, 16 Nov 2006 19:56:36 -0000, you wrote:

>How do I do this:
>From the command prompt issue a simple select query to a specified database
>and direct the output to a file.
>I can see there is the .output FILENAME option, but nothing seems to
happen.
>.output stdout works fine with output to the screen.
>Must be overlooking something simple here.
>
>RBS

.output FILENAME 
doesn't do anything by itself, it only sets the name of the file
any follwing commands will write output to.
Once you execute a query afterwards the file should be created.
If you want the file in another directory than the current one,
use slashes in the path, not backslashes.

The following code works for me:

C:\DATA\opt\test>sqlite3 tmp/test.db3
SQLite version 3.3.8
Enter ".help" for instructions
sqlite> .mode list
sqlite> .headers off
sqlite> .output tmp/master.html
sqlite> SELECT '<html><head><title>Database schema</title><link
rel="stylesheet" type="text/css" href="/css/sqlite.css"
/></head><body>';
sqlite> SELECT '<h1>Report on database schema TEST</h1><table
summary="list of tables"><caption>tables</caption>';
sqlite> .mode html
sqlite> .headers on
sqlite> select * from sqlite_master order by type,name;
sqlite> .mode list
sqlite> .headers off
sqlite> SELECT '</table></body></html>';
sqlite> .q

C:\DATA\opt\test>
-- 
  (  Kees Nuyt
  )
c[_]

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




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

Reply via email to