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?

funcion as default-value is not allowed AFAIK


but timestamp will help you to get what you want!
http://www.mysql.com/doc/en/DATETIME.html


-- Sebastian Mendel

www.sebastianmendel.de
www.tekkno4u.de
www.nofetish.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