Mark de Vries <[EMAIL PROTECTED]> writes: > But I still don't know how to do what I want to do. Perhaps I need to > explain with a litle more detail what I mean. Consider the following > table. > > create table foo ( > value TEXT, > date_create TEXT, > date_lch TEXT > ); > > Now, whenever I insert into this table I want to set date_create to > CURRENT_TIMESTAMP. > > Whenever I update a row I want date_lch (lch=last change) to be set to > CURRENT_TIMESTAMP. (Changes to the date_create col should be (silently) > 'ignored'.
I think this is what you're looking for. CREATE TRIGGER foo_insert_tr AFTER INSERT ON foo BEGIN UPDATE foo SET date_create = CURRENT_TIMESTAMP WHERE ROWID = new.rowid; END; CREATE TRIGGER foo_update_tr AFTER UPDATE ON foo BEGIN UPDATE foo SET date_lch = CURRENT_TIMESTAMP WHERE ROWID = new.rowid; END; Derrell