Hi, is there an elegant way to simulate a dynamic UPSERT in SQLite since it doesn’t has an UPSERT?
So, if I have a table with 30 columns and my code updates sub-sets out of these columns, I don’t want to write queries that manually retrieve the old values one by one. insert or replace into Book (ID, Name, TypeID, Level, Seen) values ( (select ID from Book where Name = "SearchName"), "SearchName", 5, 6, (select Seen from Book where Name = "SearchName")); So, for every column I don’t want to change I need to add a sub-select statement. If I need to build this statement dynamically, IMO it would be better to handle this code directly in code: if(record-exists?){ UPDATE … } else { INSERT … } Any suggestions / feedback? Viele Grüsse. -- Robert M. Münch, CEO M: +41 79 65 11 49 6 Saphirion AG smarter | better | faster http://www.saphirion.com http://www.nlpp.ch
signature.asc
Description: OpenPGP digital signature
_______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users