Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Timestamp & Datetime

forums forums SQLyog Using SQLyog Timestamp & Datetime

  • This topic is empty.
Viewing 1 reply thread
  • Author
    Posts
    • #9780
      energylevel
      Member

      I'm trying to set up a MySQL 4.1 DB with two date fields, one which records the date of the record creation and a second which updates every time the record is created, I thnk ti is possible but can't get it working. I've got some PHP pages which add/update the records but the date fields are not working.How do I create deafult values in SQLyog I have tried to enter CURRENT_TIMESTAMP and NOW() for the default value but it doesn;t seem to be accepting them .. ????

    • #22050
      peterlaursen
      Participant

      “one which records the date of the record creation and a second which updates every time the record is created”

      Not possible!

      http://dev.mysql.com/doc/refman/5.0/en/timestamp-4-1.html

      Quote:
      For one TIMESTAMP column in a table, you can assign the current timestamp as the default value and the auto-update value. It is possible to have the current timestamp be the default value for initializing the column, for the auto-update value, or both. It is not possible to have the current timestamp be the default value for one column and the auto-update value for another column.

      Your application(s) must handle it by explicitly writing “now()” or “CURRENT_TIMESTAMP” to either of the columns when either INSERTING or UPDATING. SQLyog 5.1 support writing “now()” or “CURRENT_TIMESTAMP” from the grids:

      http://www.webyog.com/faq/8_116_en.html

      http://www.webyog.com/faq/8_99_en.html

      (and BTW this behaviour will be optional in 5.17)

Viewing 1 reply thread
  • You must be logged in to reply to this topic.