On 2016/03/09 5:03 PM, Tilsley, Jerry M. wrote:
> All,
>
> I'm trying to use the INSERT OR REPLACE syntax so that I don't have to worry 
> about duplicate entries without creating a trigger.  Using the schema:
> CREATE TABLE messages (id numeric);
>
> and using the SQL:
> insert or replace into messages values (1);
>
> Why does this result in multiple rows of the same value?  I'm I just not 
> understanding the syntax correctly?

Nothing wrong with the syntax. I assume you don't have a unique 
constraint (Index) on that column, so the DB has no trouble adding more 
than one entry.

The REPLACE mechanism only works if it Can't insert a row because one 
already exists AND the DB does not allow more than one to exist, only 
then does it replace the previous.

Hope that was the problem!
Ryan



Reply via email to