I suggest only using "insert or replace" if you genuinely want to delete and 
replace with a new row. This is generally not hat you want if there are any 
foreign keys.

Only use "insert or ignore" if you are inserting exactly the same row as what 
might already be there.

Otherwise use a combination of insert and update.

So, for example, if you are wanting to add a person that may not already be in 
your table:

insert or ignore into "Person" ("First Name", "Last Name", "Company", "Email")
select 'Tom', 'Brodhurst-Hill', 'BareFeetWare', 'develo...@barefeetware.com')
;
update "Person"
set "Email" = 'develo...@barefeetware.com'
where "First Name" = 'Tom' and "Last Name" = 'Brodhurst-Hill'
;

This will insert if not already there and update if it is.

If you post your specific schema and non-idea insert or replace, I can show you 
in that context.

Thanks,
Tom

Tom Brodhurst-Hill
BareFeetWare

--
iPhone/iPad/iPod and Mac software development, specialising in databases
develo...@barefeetware.com
--
Twitter: http://twitter.com/barefeetware/
Facebook: http://www.facebook.com/BareFeetWare

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

Reply via email to