On Wed, Jul 23, 2014 at 4:28 AM, shweta gk <shwetag...@gmail.com> wrote:

> Hi SQlite Support Team,
>
> I have queries to generate csv file written in a export.sql file. I'm
> calling export.sql from a batch file.
>
> One of the queries in export.sql has where clause , to which i have to
> send a value from batch file. Which syntax is used for this
> functionality.
>
> I need to send the a parameter from batch file to export.sql file. How
> can this be done. Kindly send me sample code, as i could not find
> anything regarding this issue in the web search.
>

I don't know if you're still reading since I read a rather terse message
earlier wanting out of the list, but just in case this might help you (or
others) here is a way you can accomplish this sort of task with Windows
batch files without needing any changes to the sqlite command line tool.

Instead of creating a sql script that takes parameters from a batch file,
use the batch file to create the sql script. For example:

mybatchfile.bat:

@REM ********************************
@echo off
if "%1"=="" echo usage: mybatchfile value
if "%1"=="" goto :EOF
echo SELECT * > mysqlscript.sql
echo FROM TABLE >> mysqlscript.sql
echo WHERE COLUMN = %1; >> mysqlscript.sql
sqlite3 database.db ".read mysqlscript.sql"
del mysqlscript.sql
@REM ********************************

Now this is just an example of course and it would require adapting to your
exact situation. Regardless, it should give you an idea of how you can
create the SQL code you need from the batch file itself (expanding
parameters passed from the batch file into the generated SQL) without
needing any modifications to sqlite3.exe.

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

Reply via email to