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
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
Your trigger basically does this:
UPDATE t SET b = DATETIME('now','localtime') WHERE 1 != 0;
So it updates all rows in the table. Try to change it to this:
UPDATE t SET b = DATETIME('now','localtime') WHERE rowid = new.rowid;
Pavel
On Sun, May 31, 2009 at 7:44 AM, Oliver Peters
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
Here's my script for reproduction:
-
CREATE TABLE IF NOT EXISTS t(
a
4 matches
Mail list logo