Am Montag, den 01.06.2009, 07:38 -0400 schrieb Igor Tandetnik:
> Oliver Peters wrote:
> > After an UPDATE in a record I want the update time stored in a column
> > of this record - the problem is that the trigger I use doesn't work
> > only in this record but in all others
> >
> > CREATE TRIGGER IF NOT EXISTS t_update_a
> >  AFTER UPDATE ON t
> >   BEGIN
> >     UPDATE t SET b = DATETIME('now','localtime') WHERE new.a != old.a;
> >   END;
> 
> Make it
> 
> CREATE TRIGGER IF NOT EXISTS t_update_a
>  AFTER UPDATE OF a ON t
>   BEGIN
>     UPDATE t SET b = DATETIME('now','localtime') WHERE rowid=new.rowid;
>   END;
> 
> Igor Tandetnik 
> 
> 

Thanks - that was the solution

First I didn't understand why this could work because the rowid I
queried never changed after an update but after studying the
documentation I discovered that it is only an alias for the real rowid.
Very helpful to know.

Oliver Peters

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to