Yes, of course.  But, it seems a waste of time, since you're obviously already 
at the record (or at least done the initial index search) to not be able to 
simply update it.

Not complaining, mind you.  MS SQL doesn't have it, and I've long learned to 
deal with it.

Also, there are times when you do a bulk insert, so you have to structure the 
query to not fail on records that are already present.

-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Simon Slavin
Sent: Tuesday, September 24, 2013 2:06 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Bug : Tcl interface + "INSERT OR REPLACE" statement


On 24 Sep 2013, at 6:58pm, Petite Abeille <petite.abei...@gmail.com> wrote:

> On Sep 24, 2013, at 7:54 PM, "Marc L. Allen" <mlal...@outsitenetworks.com> 
> wrote:
> 
>> Yep.  What most people want is an INSERT OR UPDATE.  
> 
> Yep. Which is what one usually calls 'MERGE':
> 
> http://en.wikipedia.org/wiki/Merge_(SQL)
> 
> And sadly, SQLite doesn't provide anything like that at all.

Which is why you do an INSERT first, and allow it to fail, then do the UPDATE.
Or do an UPDATE first and iff that fails, do an INSERT.

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


This email and any attachments are only for use by the intended recipient(s) 
and may contain legally privileged, confidential, proprietary or otherwise 
private information. Any unauthorized use, reproduction, dissemination, 
distribution or other disclosure of the contents of this e-mail or its 
attachments is strictly prohibited. If you have received this email in error, 
please notify the sender immediately and delete the original.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to