Re: [sqlite] UPDATE and default values

2013-11-10 Thread Simon Slavin

On 10 Nov 2013, at 9:03pm, Ulrich Goebel  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  AFTER UPDATE ON  ...



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


[sqlite] UPDATE and default values

2013-11-10 Thread Ulrich Goebel

Hallo,

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?


Ulrich


--
Ulrich Goebel
Paracelsusstr. 120, 53177 Bonn
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users