Hi, there,

I have MySQL 4.1.10. I need to add a timestamp column to an existing table. I am having a problem of setting the newly added column to be the current time.

 This is what I did:

CREATE TABLE try (id INTEGER); INSERT INTO try VALUES(1), (2), (3);

ALTER TABLE try ADD timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP;

SELECT * FROM try;

+------+---------------------+

| id   | timestamp           |

+------+---------------------+

|    1 | 0000-00-00 00:00:00 |

|    2 | 0000-00-00 00:00:00 |

|    3 | 0000-00-00 00:00:00 |

+------+---------------------+



I've read the on-line manual regarding the change in timestamp, still couldn't figure out why 0's got inserted instead of a meaningful current time stamp. I would greatly appreciate if someone can let me know what the correct way is. Unfortunately I cannot recreate the table.

  Thank you very much!

Regards,
Zhe


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



Reply via email to