On 4/23/2014 6:05 AM, Peter Hardman wrote:
I have a table where I need to set a timestamp field when a new record
is INSERTED. The table uses an auto-increment key field so a BEFORE
INSERT trigger is ruled out. An AFTER INSERT trigger which UPDATEs the
new row solves that problem, but I have a second, AFTER UPDATE, trigger
on the table to save an audit record when the table is updated. I need a
way of preventing the AFTER UPDATE trigger running as a result of the
UPDATE command in the AFTER INSERT trigger.
You don't need a trigger. Just give your timestamp column a DEFAULT
clause, e.g.
DEFAULT CURRENT_TIMESTAMP
or
DEFAULT (strftime('%Y-%m-%d %H:%M:%f','now', 'localtime'))
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users