Martin Engelschalk <[EMAIL PROTECTED]> writes: > Hi Lloyd, > > i am not sure, but i checked the documentation and i don't think it ist > sound. > In your Update, the ROWID semms to refer to ingredients.rowid. However, > you want to set properties.rowid. > Can it be that it works, because Properties and Ingredients happen to > have the same number of rows? > > Martin > > Lloyd Dupont schrieb: > >> thanks Martin it worked! >> although I replaced your (SELECT MAX(ID) FROM Properties) by ROWID. >> is it sound? >> >> like that: >> CREATE TRIGGER create_ingredient_property AFTER INSERT ON Ingredients >> BEGIN >> INSERT INTO Properties (price) VALUES (NULL); >> UPDATE Ingredients >> SET property_ID = ROWID >> WHERE ID=OLD.ID; >> END;
According to the documentation, you should be able to use the last_insert_rowid() function: CREATE TRIGGER create_ingredient_property AFTER INSERT ON Ingredients BEGIN INSERT INTO Properties (price) VALUES (NULL); UPDATE Ingredients SET property_ID = last_insert_rowid() WHERE ID=OLD.ID; END; Derrell