Nicholas,

just found something on google:
"In general, this cannot be done. Default values cannot be the return of
a
MySQL function (as much as I'd love to use NOW() for default values!).

However, there's one loophole. When inserting, not specifying a value
for
the first timestamp field in a table will generate the current
timestamp. "


Best work around I can think of is to set your field as an int 
and include unix_timestamp(NOW()) in your inserts



-----Original Message-----
From: Nicolas Verhaeghe [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 10, 2006 2:33 PM
To: mysql@lists.mysql.com
Subject: Can I set UNIX_TIMESTAMP() as default?

I would like an integer field to capture the current date as a Unix
Timestamp by default.

But this will not be accepted at all.

I get the error "invalid default value for [field name]"

Is there a workaround?

Thanks!


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


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

Reply via email to