View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 07:02 AM
joe
 
Posts: n/a
Default RE: repost timestamp for update & insert

Your missing your data type for the spdate_updated attribute

CREATE TABLE tbl_spdate(
spdate_ID int NOT NULL PRIMARY KEY AUTO_INCREMENT , spdate_date date NOT
NULL , spdate_notes varchar( 100 ) , spdate_created timestamp default 0,
spdate_updated timestamp default CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP );

-----Original Message-----
From: Hiep Nguyen [mailto:hiep@ee.ucr.edu]
Sent: Thursday, November 29, 2007 8:24 AM
To: mysql@lists.mysql.com
Subject: repost timestamp for update & insert

i asked this question before, but when i tried what D.Vin suggested, i got
an error.

mysql version is 4.1.12

i tried:

CREATE TABLE tbl_spdate(
spdate_ID int NOT NULL PRIMARY KEY AUTO_INCREMENT , spdate_date date NOT
NULL , spdate_notes varchar( 100 ) , spdate_created timestamp default 0,
spdate_updated default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP );

and i got this:

#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
'default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )' at line 7

am i have a wrong version?

Thanks,
T. Hiep

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=joe@piscitella.com

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.6 - Release Date: 11/24/2007 12:00
AM


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.6 - Release Date: 11/24/2007 12:00
AM


Reply With Quote