Nick Brandon wrote:
Hi
I have a AFTER UPDATE trigger that I want to be called only during an UPDATE SQL statement. Part of the schema is below
....
CREATE TRIGGER create_data_history AFTER UPDATE ON data BEGIN INSERT INTO data_history (data_ref, value, reason, user, timestamp) VALUES (OLD.ref, OLD.value, OLD.reason, OLD.user, OLD.timestamp); END;
The problem occurs when I insert a new record into the table data. For some reason the create_data_hisotry trigger is executed. Could someone explain this to me.
There waa a discussion about this issue (or a closely related one) a couple months ago. Look at ticket: http://www.sqlite.org/cvstrac/tktview?tn=368
and check the archives: http://www.mail-archive.com/sqlite-users%40sqlite.org/
for the thread "ON INSERT trigger" starting 10/12.
Sorry I can't give a real answer, but hope this helps.
Gerry