At 15:28 04/08/2007 -0400, Igor Tandetnik wrote:
UPDATE mytable SET timestamp = old.timestamp + 1 WHERE rowid=new.rowid;

Great :-) Thanks a lot. For those interested in doing the same thing:

=============
create table mytable (id INTEGER AUTO PRIMARY KEY, name VARCHAR(50), timestamp INTEGER);

CREATE TRIGGER update_timestamp UPDATE ON mytable
BEGIN
UPDATE mytable SET timestamp = old.timestamp + 1 WHERE rowid=new.rowid;
END;

insert into mytable values (NULL,'Marge',1);

select * from mytable;

update mytable set name='Homer' where id=1;

select * from mytable;
=============

Since I'm at it, I'll check if I can have SQLite put a timestamp equal to 1 when creating a new record so the user doesn't have to.

Thanks everyone
G.


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to