Scott Purcell wrote:
I am trying to create simple reference table for some cookies I am creating. I
wanted to put in a current_timestamp each time I do an insert so I can delete
this data after 2 or 3 weeks.
Here is the insert statement:
CREATE TABLE COOKIE_REF (cookie_ref varchar(50), dat timestamp default
current_timestamp)
I am trying to insert the below statement, but it fails with a 1064
Error Code : 1064
You have an error in your SQL syntax. Check the manual that corresponds to
your MySQL server version for the right syntax to use near 'current_timestamp)'
at line 1
(0 ms taken)
I am running version 4.0.15-max-debug on windows. and following this link but
It will not work. What can I be doing wrong?
http://dev.mysql.com/doc/mysql/en/datetime.html
You might want to try asking on a MySQL list, or looking at your version
number vs. the version numbers referenced in the MySQL documentation: "
Beginning with MySQL 4.1.3, the |CURRENT_TIMESTAMP()|, |CURRENT_TIME()|,
|CURRENT_DATE()|, and |FROM_UNIXTIME()| functions return values in the
connection's current time zone, which is available as the value of the
|time_zone| system variable."
You may not be able to use "current_timestamp()" in 4.0, but you might
be able to use "now()" (although IIRC I never had particularly goodluck
with getting default values into time or date fields, but that was back
in 3.xx days).
Dave