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 <oliver....@web.de> 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 > > > Here's my script for reproduction: > ----------------------------------------- > > CREATE TABLE IF NOT EXISTS t( > a TEXT NOT NULL, > b TEXT DEFAULT NULL > ); > > 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; > > INSERT INTO t > (a) VALUES('V'); > > INSERT INTO t > (a) VALUES('S'); > > UPDATE t > SET a = 'K' WHERE a ='S'; > > SELECT * FROM t; > > > Thank you for your help > _______________________________________________________________________ > Nur bis 31.05.: WEB.DE FreeDSL Komplettanschluss mit DSL 6.000 Flatrate > und Telefonanschluss für 17,95 Euro/mtl.! http://produkte.web.de/go/02/ > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users