Re: [sqlite] export table to csv
On 24 Jan 2014, at 6:24am, Frantisek Cervenwrote: > I want to ask you if is any way to call sqlite special commands > programatically from c#. These 'special commands' are not in SQLite at all. They are features of the command-line shell application. SQLite does not understand any command starting with a dot. > E.g. I need something like this in code not in command line: > > sqlite> .mode csv > sqlite> .output test.csv > sqlite> select * from tbl1; > sqlite> .output stdout > > If not, what is the quicker way to export table programatically? Now I`m > doing it with DbDataReader, but it is slow. I'm afraid that the way to do that quickly is to write some C# code which does it. A slower way to do it would be to have C# issue an operating system command that makes the shell tool do it. > Ps: There is not any support user forum?? This is it ! Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] export table to csv
Hello, I want to ask you if is any way to call sqlite special commands programatically from c#. E.g. I need something like this in code not in command line: sqlite> .mode csv sqlite> .output test.csv sqlite> select * from tbl1; sqlite> .output stdout If not, what is the quicker way to export table programatically? Now I`m doing it with DbDataReader, but it is slow. Ps: There is not any support user forum?? Thank you, Fratnisek ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] export table to csv
You can only use one command in the command-line. Use options for the others, like this: Sqlite3.exe -csv -separator ',' ioimport.db3 "select * from iotemplate;" >thisisit.csv -Original Message- From: Richard Nero [mailto:rich...@rlnero.com] Sent: Monday, March 30, 2009 10:12 AM To: sqlite-users@sqlite.org Subject: [sqlite] export table to csv All, I can successfully import a databese via command line with: sqlite3.exe -separator , ioimport.db3 ".import Temp.csv iofromexcel" Now i am trying to export a table in the db with: sqlite3.exe ioimport.db3 .mode csv .separator , .output thisisit.csv "select * from iotemplate;" .output stdout This does not work and I have tried all solutions possible. Can someone lead me in the right direction on how to do this via command line Thanks in advance! ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] export table to csv
Hi Richard, The sqlite3 utility allows a *single* dot-command on the command line itself. You can have an unlimited number of commands in a separate text file, though. http://www.sqlite.org/sqlite.html So, using Windows syntax, you can have something like: === Set MyTempFile=%temp%\Mytemp.tmp echo .separator ,>%myTempFile% Echo .output thisisit.csv >>%myTempFile% Echo select * from iotemplate;>>%myTempFile% Echo .output stdout >>%myTempFile% Sqlite3.exe ioimport.db3 ".read %myTempFile%" Del %mytempfile% >nul If you're using linux/unix, you can redirect input to the your shell script and avoid the temporary file. Hope this helps, Donald -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Richard Nero Sent: Monday, March 30, 2009 11:12 AM To: sqlite-users@sqlite.org Subject: [sqlite] export table to csv All, I can successfully import a databese via command line with: sqlite3.exe -separator , ioimport.db3 ".import Temp.csv iofromexcel" Now i am trying to export a table in the db with: sqlite3.exe ioimport.db3 .mode csv .separator , .output thisisit.csv "select * from iotemplate;" .output stdout This does not work and I have tried all solutions possible. Can someone lead me in the right direction on how to do this via command line Thanks in advance! ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] export table to csv
All, I can successfully import a databese via command line with: sqlite3.exe -separator , ioimport.db3 ".import Temp.csv iofromexcel" Now i am trying to export a table in the db with: sqlite3.exe ioimport.db3 .mode csv .separator , .output thisisit.csv "select * from iotemplate;" .output stdout This does not work and I have tried all solutions possible. Can someone lead me in the right direction on how to do this via command line Thanks in advance! ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users