, 12 Mar 2020 at 08:04, Clemens Ladisch wrote:
> David Blake wrote:
> > CREATE TRIGGER my_update_trigger BEFORE UPDATE ON My_table
> > FOR EACH ROW WHEN NEW.lastupdated < OLD. lastupdated
> > BEGIN
> > UPDATE my_tableSET lastupdated = DATETIME('now') WHERE id
Ha, my error - missing ";" in the UPDATE clause but I was blind.
On Thu, 12 Mar 2020 at 08:18, David Blake wrote:
> Thanks for such a swift reply, good to know that it should work (without
> typos)
>
> >Thank you very much for keeping the error message secret.
>
I'm looking for an easy way to maintain a last updated column for each
record in several tables and considering if using a triggers is viable.
I thought that defining a trigger like this on each table would work
CREATE TRIGGER my_update_trigger BEFORE UPDATE ON My_table
FOR EACH ROW WHEN
Thanks Andy
> In addition, the role of the "when" clause is unclear. Is it necessary?
>
> I don't think it is. I have a very similar trigger which I've been using
> for several years
> And it doesn't have the where...
>
> CREATE TRIGGER [UpdatePortTime] AFTER UPDATE ON ports
> FOR EACH ROW
>
4 matches
Mail list logo