*This works fine:*

echo 1 | sqlite dbfile ".import '/dev/stdin' foo"

But if you have any character (like a space, or newline), or sql statement
in front of the '.import', sqlite gives:
"Error near "." syntax error

*Why it matters:*
*
*
Because what I'm really trying to do is to import data ignoring dups.
Since .import does not have this functionality, I want to create a temp
table, import into it, and then copy to the target with 'on conflict ignore'
Because  I want that table to be temporary,  I cannot use 2 separate sqlite
invokes.

*This is the goal:*
echo 1 | sqlite dbfile "
create temp table foo(c);
.import '/dev/stdin' temp.foo
insert into Foo(c) select c from temp.foo *on conflict ignore*;
"

This does not work because there's something before .import (newline alone
would have the same effect)

This does work, if executed interactively:

*$sqlite foo
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create temp table foo (c);
sqlite> .import '/dev/stdin' temp.foo
1
sqlite> select * from temp.foo;
1
sqlite> .quit*
*
*
*Thank you.*
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to