Hello !
I have been trying to search for this solutions for days,yet did not find
the solution.
I want to write an insert query on a table. When there is a conflicting
primary key
then it should increment the primary key and insert the row .
For example i want to run this query
INSERT INTO temp VALUES("1","112","112");
Here first column is auto increment primary Key.
This query will add the record(20,112,112) in the table
Now when i run the query as
INSERT INTO temp VALUES("1","100","100");
I want the result as (2,100,100)
But it give unique constraint error.
How can i do that ,i.e, duplicate primary key comes in a table insert the
new record and change the primary key of the new record.
I have used this query but did not work
insert or replace INTO temp (tempID,Address,Weight)
VALUES(new."tempID",new."Address",new."Weight") ;
SELECT RAISE(IGNORE);
END
--
View this message in context:
http://old.nabble.com/On-conflicting-Primary-key-how-to-insert-record-and-increment-the-Key-tp27904087p27904087.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users