hey what i want to do is select everything from the table and insert data into it if its not already present in the table or update the data if present in the table. The problem here is if my table is empty there is nothing to select and hence the query is not executed and therefore it neither inserts nor updates my table. NOTE: My insert and update query are written in the select query in if else condition.
A:
You can use the INSERT OR REPLACE statement. Also, see the following links.
http://stackoverflow.com/questions/2251699/sqlite-insert-or-replace-into-vs-update-where
Garett
2010-07-23 05:41:33
hey i dont want to replace the data but update it.
2010-07-23 05:52:45
The INSERT OR REPLACE statment inserts the values if they do not exist. Otherwise it updates the vales if they already exist. Did you view the links I provided?
Garett
2010-07-23 05:59:35
Sorry for so many questions but i m really new to iphone and objective C platform . yes, n i did see the insert or replace query before but i want to update the entries only if they exist and also the manipulation takes place only after i retrieve all my data from the table.
2010-07-23 06:13:17