List:General Discussion« Previous MessageNext Message »
From:Zhe Wang Date:February 28 2005 3:05pm
Subject:problem with adding timestamp as a column
View as plain text  
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

Thread
problem with adding timestamp as a columnZhe Wang28 Feb
  • Re: problem with adding timestamp as a columnHank28 Feb
    • innodb_buffer_pool_size - max_connections?Deluxe Web28 Feb
      • INNODB MONITOR OUTPUTDeluxe Web3 Mar
    • Re: problem with adding timestamp as a columnJoerg Bruehe28 Feb
      • Re: problem with adding timestamp as a columnZhe Wang28 Feb