Discussion:
Send parameter from batch file to sqlite
shweta gk
2014-07-23 10:28:40 UTC
Permalink
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.


Kindly reply ASAP.

Thanks & Regards,
Shweta.G.K
shweta gk
2014-07-23 10:36:07 UTC
Permalink
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.


Kindly reply ASAP.

Thanks & Regards,
Shweta.G.K
shweta gk
2014-07-23 11:09:47 UTC
Permalink
Thanks & Regards,
Shweta.G.K



---------- Forwarded message ----------
From: shweta gk <shwetagk87-***@public.gmane.org>
Date: Wed, Jul 23, 2014 at 4:05 PM
Subject: Fwd: Send parameter from batch file to sqlite
To: sqlite-dev <sqlite-dev-CzDROfG0BjIdnm+***@public.gmane.org>


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.


Kindly reply ASAP.

Thanks & Regards,
Shweta.G.K
Simon Slavin
2014-07-23 12:18:07 UTC
Permalink
We don't know what operating system or command shell you're using. So our advice is to write your own editor which takes your export.sql file and the output of your batch file and puts them together to make a new .sql file with the commands you want.

Simon.
shweta gk
2014-07-23 12:20:43 UTC
Permalink
Operating system : Windows
I am using DOS command shell.
Thanks & Regards,
Shweta.G.K
Post by Simon Slavin
We don't know what operating system or command shell you're using. So our advice is to write your own editor which takes your export.sql file and the output of your batch file and puts them together to make a new .sql file with the commands you want.
Simon.
_______________________________________________
sqlite-users mailing list
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
shweta gk
2014-07-24 10:35:31 UTC
Permalink
I want to unsubscribe from this forum. Please remove my mail from the
list. Its irritating to get unnessary mail.
Thanks & Regards,
Shweta.G.K
Post by shweta gk
Operating system : Windows
I am using DOS command shell.
Thanks & Regards,
Shweta.G.K
Post by Simon Slavin
We don't know what operating system or command shell you're using. So our advice is to write your own editor which takes your export.sql file and the output of your batch file and puts them together to make a new .sql file with the commands you want.
Simon.
_______________________________________________
sqlite-users mailing list
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
John McKown
2014-07-24 11:17:30 UTC
Permalink
No one here can do it for you. We're not admins. But if you go to the
web site referenced at the bottom of _every single email_ from this
list, you can do it yourself.
Post by shweta gk
I want to unsubscribe from this forum. Please remove my mail from the
list. Its irritating to get unnessary mail.
Thanks & Regards,
Shweta.G.K
_______________________________________________
sqlite-users mailing list
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
--
There is nothing more pleasant than traveling and meeting new people!
Genghis Khan

Maranatha! <><
John McKown
Tony Papadimitriou
2014-07-24 20:54:56 UTC
Permalink
Not possible directly from SQLite.

Some weeks ago I suggested a possible way to have this capability added to
the shell version of SQLite3 but there seems to be zero interest from the
developers. So, don't hold your breath. Better yet, write a Lua script or
something to do it. (If you do, maybe you'd like to share it.)

-----Original Message-----
From: shweta gk

...
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.

...
Scott Robison
2014-07-24 21:20:59 UTC
Permalink
Post by shweta gk
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

Loading...