forums › forums › SQLyog › SQLyog Comments › timestamp function
- This topic is empty.
-
AuthorPosts
-
-
October 4, 2003 at 8:57 pm #8195AnonymousGuest
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
-
October 6, 2003 at 7:12 am #15014ShadowMemberQuote: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…
-
October 6, 2003 at 9:31 am #15015RiteshMember
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
-
October 6, 2003 at 10:06 am #15016ShadowMember
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…
-
-
AuthorPosts
- You must be logged in to reply to this topic.