On 10 Nov 2013, at 9:03pm, Ulrich Goebel <m...@fam-goebel.de> wrote:

> I want to have a column 'last_changed' in a table, which shows the date of 
> the last change (inser or update) of the row. I though the default value in 
> the CREATE TABLE was a good idea:
> 
> CREATE TABLE (
>  id integer,
>  name text,
>  last_changed text default current_date
> )
> 
> That works for INSERTs, but seems not to work for UPDATEs. Is that right? 
> What to do?

CREATE TRIGGER <triggername> AFTER UPDATE ON <tablename> ...

<http://www.sqlite.org/lang_createtrigger.html>

Not as simple a solution as setting a default, but it should work.

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

Reply via email to