0

I have a table in an Amazon Web Service (AWS) Relation Database Service (RDS) and the table columns are "Memory", "Cores", "Speed" and "Insert_Timestamp" and I am trying to get the database to log each time a new row is added to this table. With this being said, I am running the following code Alter table Instace_Types ALTER COLUMN Insert_Timestamp SET DEFAULT CURRENT_TIMESTAMP. I am running into this error:

 "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 'COLUMN Insert_Timestamp SET DEFAULT CURRENT_TIMESTAMP' at line 1" 

any input would be greatly appreciated.

Iłya Bursov
  • 23,342
  • 4
  • 33
  • 57
  • try to use `Alter table Instace_Types ALTER COLUMN Insert_Timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;` – Iłya Bursov Jun 10 '14 at 19:50
  • That alter statement may not work depending on your MySQL version. If you cannot alter your table you can always consider supplementing your insert/update query with `insert_timestamp = now()` as a work around. – Frank Tudor Jun 10 '14 at 19:52

1 Answers1

0

The second ALTER should be a CHANGE.

Alter table Instance_Types 
     CHANGE Insert_Timestamp 
            Insert_Timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
O. Jones
  • 103,626
  • 17
  • 118
  • 172