On 07-09-2013 07:16, dmitry babitsky wrote:
*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*;
"
Try:
echo 1 | sqlite dbfile <<HERE
create temp table foo(c);
.import '/dev/stdin' temp.foo
insert into Foo(c) select c from temp.foo *on conflict ignore*;
HERE
(above does not work on Windows....)
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users