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

timestamp function

forums forums SQLyog SQLyog Comments timestamp function

  • This topic is empty.
Viewing 3 reply threads
  • Author
    Posts
    • #8195
      Anonymous
      Guest

      Hi

      I am working on a database project that has both the recordcreationdate(which needs to automatically store the current date when the record is created) and recordmodificationdate(which needs to store the latest date when the record was modified)..i was reading through one of MySQl books which allows us to achieve this by using the TIMESTAMP data type where the first declared timestamp field gets changed when changes are made to the record thus working as the recordmodification date field and any subsequent ones are entered when the record is created but they dont change with changes made to the specific records.

      I tried to do this through SQLyog which doesnt incorporate these changes if i right click on the table and then chose the insert/update data option and make changes to the record…However when i go through the editor i.e if i modify the record using the editor it makes changes to the recordmodification time.

      AS the intended users of my project want this field to be auomatically entered and automatically create the data for record creation and record modification ..i need to solve this…any suggestions or help would be really appreciated


    • #15014
      Shadow
      Member
      Quote:
      The TIMESTAMP column type provides a type that you can use to automatically mark INSERT or UPDATE operations with the current date and time. If you have multiple TIMESTAMP columns, only the first one is updated automatically.

      The solution is also provided in the MySql manual:

      Quote:
      TIMESTAMP columns other than the first may also be set to the current date and time. Just set the column to NULL or to NOW().

      I suggest to use NOW(), though…

    • #15015
      Ritesh
      Member

      The above function is not possible with SQLyog's Insert/Update window as it updates each and every column for every update statement. Therefore, the automatic generation of TIMESTAMP from MySQL is not possible.

      Updation of changed columns is planned for SQLyog Max

      HTH

    • #15016
      Shadow
      Member

      Or you could instruct the users to set the value of the second timestamp column to NULL. BTW, I don't think it is a good idea to use SQLyog as a data-entry tool…

Viewing 3 reply threads
  • You must be logged in to reply to this topic.