Home > Default > Adding a timestamp field to a table (MySQL database)

Adding a timestamp field to a table (MySQL database)

November 30Hits:0
Advertisement
I've defined a field in a MySQL table as type 'timestamp'
eg. 2010-05-25 21:36:19
When I perform an insert using coldfusion, the row doesn't change the value in the timestamp automatically
Am I better creating my own timestamp field, type varchar and manually insert my timestamp values ?

Answers

No, it is a pretty bad idea to use a text field to store date-time information.  It makes it much harder to do date and|or time calculations on the data.
A timestamp field does not mean you have a field that automatically inserts a timestamp on record insert and|or update.  Just that you have a field that expects a 'timestamp' value which is usually a date-time value down to the millisecond precision.
You can set up the database to automatically create this value when data is inserted and|or updated, but that is more then just creating the timestamp field.  And the specifics will change depending on your exact database management system.  Searching the internets for information on your database managerment system of choice and auto and|or default values for fields should guide you in the correct direction.
Or you can insert timestamp data along with the other data you are inputting into the database.  The now() function combined with the <cfqueryparam value="#timeData#" cfsqltype="cf_sql_timestamp"> is a useful combination to do this.

Read other 6 answers

Tags:

Related Articles

  • Adding a timestamp field to a table (MySQL database)November 30

    I've defined a field in a MySQL table as type 'timestamp' eg. 2010-05-25 21:36:19 When I perform an insert using coldfusion, the row doesn't change the value in the timestamp automatically Am I better creating my own timestamp field, type varchar and

  • Adding a new field to the tableOctober 11

    Hello friends, I have a custom table and is in  use from a long time now. Now i need to add a new field to that table. 1 - can i go directly to the change mode and then add it or is their any other way that needs to be followed. 2 - once added do i n

  • Implications of adding new key fields to existing tableOctober 11

    Hi All, I have searched forum regarding this. But didn't find exact answer. We are planning to add new key fields to existing Ztable. I want to know the implications of this. I have checked the where used list of table and found no impact. Only one p

  • Storing the Timestamp field in the TableOctober 11

    Hi I have a Z program and we need to store the timestamp field in the Z table . I have created the table with the dataelement TIMESTAMP . Is there any system field that can be used to store the timestamp field from your program say for example we hav

  • Regarding adding a Custom field to Standard TableNovember 30

    Hi ABAPers, Can any one explain the below spec-description. "The purpose of this design is to provide the foundation for a more automated solution to the invoice reconciliation process.  This design calls for adding a custom field to the standard SAP

  • Adding a new field in QM02 table controlNovember 30

    Hi Gurus, I have the requirement to add a new field in a table control in QM02.I have added the field in the view VIQMMA but I dont know how it can be added in screen. Is it possible through some SPRO customization? Regards, RajatHi Rajat, Welcome to

  • Adding a new field in BCONT table and updating itNovember 30

    Hi All, Is there any BAPI/BADI which will allow to add a new field in standard BCONT table and update its value? Your solution will be really helpful. Thanks, NirupamHi Santosh, This is required for UCES. We need to add a field in BCONT table (SE11/S

  • Issue with adding Long charater field in custom tableOctober 11

    I have added a URL ( Internet address ) field ZZSSOURIADDR with data element AD_URI whose domain is long character and length 2048.On activation table gives an message in a log    Field ZZSSOURIADDR does not have a preceding length field of type INT4

  • Calculating elapsed time (in minutes) from a TIMESTAMP field in a tableNovember 30

    I have a table of events that contains a field, CREATION_DATE, that is defined as NOT NULL TIMESTAMP(6), and the value is normally in the format 'DD-MON-YYYY HH:MM:SS.FFFFFF xM'. I want to SELECT only those rows where the elapsed time between the CRE

  • Multi instance of timestamp field in single table?November 30

    Is this statement true? "Database does not allow multiple instances of this type if field in a single table" To me this makes so sense and I would assume it would not matter how many you had. Thoughts?Where did you get the error message? What wa

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.673 s.