On 9 Jul 2018, at 10:00pm, Thomas Kurz <sqlite.2...@t-net.ruhr> wrote:

> I get a "syntax error near on":
> CREATE TABLE test (col1 TEXT CHECK (col1<>'') ON CONFLICT IGNORE);
> 
> Am I using a wrong syntax?

Yes.  The ON CONFLICT clause goes in the INSERT command.

    CREATE TABLE test (col1 TEXT CHECK (col1<>''));
    INSERT OR IGNORE INTO test (col1) VALUES ('hello');

An alternative, recently added so available only in recent versions of SQLite3, 
is to do this:

    CREATE TABLE test (col1 TEXT CHECK (col1<>''));
    INSERT INTO test (col1) VALUES ('hello') ON CONFLICT DO NOTHING;

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

Reply via email to