Hi All,

I am trying to use a function as a default value for a column but do not
seem to get the desired result. I want to use the NOW() function for a
last_updated column, here is my code...

CREATE TABLE test_table (
  last_updated datetime NOT NULL default `NOW()`
) TYPE=MyISAM;

This gives an error;

CREATE TABLE test_table (
  last_updated datetime NOT NULL default 'NOW()'
) TYPE=MyISAM;

Now the table shows a default value of 0000-00-00 00:00:00, when I add a new
row the value of last_updated is also 0000-00-00 00:00:00. I am using MySQL
3.23.37, can anyone help?

TIA


Phil Ewington - Technical Director
----------------------------------
43 Plc
35 Broad Street, Wokingham
Berkshire RG40 1AU
T: +44 (0)118 978 9500
F: +44 (0)118 978 4994
E: mailto:[EMAIL PROTECTED]
W: http://www.43plc.com



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to