Try
create table test (
  modified TIMESTAMP AS CURRENT_TIMESTAMP(),
  name VARCHAR(20)
);

- Rami

21.5.2012 18:51, Noel Grandin kirjoitti:
you need a trigger.
http://www.h2database.com/html/features.html#triggers

On 2012-05-21 11:38, Jukka-Pekka Rahkonen wrote:
Hello,
Is there a way to create automatically updating last modified timestamp field. It is done in mysql like this:
create table test (
modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  name VARCHAR(20)
);

How to do this in H2?

This does not work:
"TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE SET DEFAULT"
it translates to:
"TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON[*] UPDATE SET DEFAULT"
and it fails.



--
You received this message because you are subscribed to the Google Groups "H2 Database" group. To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/wevHeKkPbIgJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.


--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to