Adding a timestamp field to a table (MySQL database)

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 ?

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.

Similar Messages

  • Adding a new field to the table

    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 need to go to SE14 and do something thr for the changes done to the table.
    This table also has a table Maintenence generator. Do I need to do something thr.
    Thanks,
    Bob.

    Hi,
    Check whether the change in ur custom table is going to impact any Custom program or not.
    If its so then adjust ur ABAP code so as to fit with the new table.
    Decide whether this field is going to be aprt of primary key or simple field.
    Is there any data present in ur custom table already?
    Regards,
    Lakshman.

  • Implications of adding new key fields to existing table

    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 point is making me to think again and again.
    If we add key fields to existing table then we have to adjust the table from SE14 to activate it. But this adjustment doesn't ask for TR.
    So if i release my TR, entries in other systems will also be adjusted accordingly??? Business is OK with the new fields values to be blank for existing entries.
    Thanks,
    Vinod.

    Yes the data in transported  systems will also be adjusted. If this table contains too much data make transport at late hours because it will take long and table can't be used while it's adjusted. In this adjustment process data is copied to a temporary table and moved back to original table using move-corresponding command after key added. There will data loss if you remove a key or key fields field length but in your case it shouldn't be a problem.
    Edited by: Gungor Ozcelebi on Jul 2, 2009 9:18 AM

  • Storing the Timestamp field in the Table

    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 have declared a work area of the structure of the Z table and Appended through the Internal Table and Modified that Z table.
    My intention is store the Timestamp field in the Z table.
    Nadesh

    Hi,
        you can add as below..
    types : begin of st_output.
                             include structure ztaxinvoice.
                             FKIMG1 TYPE VBRP-FKIMG,
                             FKIMG2 TYPE VBRP-FKIMG,
                             types : end of st_output.
        or you can add this field to your structure 'ztaxinvoice'  as below
    'FKIMG1 TYPE FKIMG'
                                       'FKIMG2 TYPE FKIMG'
       Then you can declare internal table and work area as mentioned below..
    data: it_output type standard table of ztaxinvoice,
                            wa_output type ztaxinvoice.
    here in this case no need of types declaration also you can pass the same type (wa_output type ztaxinvoice) in smartform.
    hope this will help you,
    Regards,
    Renuka S.

  • Regarding adding a Custom field to Standard Table

    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 table EINE as well as a data maintenance tool for the same.  There will also be a new custom table for storing values associated with the new EINE field.  These new tables will also provide users with the ability to determine which PIR are soon to expire."
    We have to add one custom field to standard table EINE, how we can add this custom field to STND table.
    According to me we can add it through append structure. is it correct or not.
    and what is data maintenance tool.
    Pls.............Explain in details.
    Thanks in advance.
    Regards,
    Ramana Prasad. T

    Hi,
    Goto SE11 ,give ur table name.Then press display button.Then in the application tool bar press on append structure ...Now create a zstructure and add ur custom field and then activate the table.
    Regards,
    nagaraj

  • Adding a new field in QM02 table control

    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,
    Rajat

    Hi Rajat,
    Welcome to SCN. I am not sure add to table control . Please have a look to add custom fields
    1. QQMA0001-incorporate additional data in notification header
    2.QQMA0008-additional data on the details screen fro notification item
    3.QQMA0010 QM/PM/SM: User Subscreen for Additional Data on Cause
    4.QQMA0011 QM/PM/SM: User Subscreen for Additional Data on Task
    5.QQMA0012 QM/PM/SM: User Subscreen for Additional Data on Activit
    If you need a custom tab then this is the procedure
    1) SPRO,Quality management,Notification,Overview of notification types, Select the notification  and 90 give the customer specific screen area
    2) function group XQQM ,create the screen under screens tab number 0090.
    Check this if need this and check and post.
    Regards,
    Madhu.

  • Adding a new field in BCONT table and updating it

    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,
    Nirupam

    Hi Santosh,
    This is required for UCES. We need to add a field in BCONT table (SE11/SE16), which will hold a flag value, i.e Y/N.
    The value will be updated through a custom FM being used in UCES, and also based on the value there is a validation inside UCES.
    This field need not be displayed inside any SAP screen.
    thanks,
    Nirupam
    Edited by: Nirupam Deb on Jun 8, 2011 11:44 AM

  • Issue with adding Long charater field in custom table

    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.
    What needs to be done to remove this error?

    As specified in SAP documentation, this must be the last field, and the previous one must be the actual length field type INT2. (suggestion: use data element AD_URILNG)
    LCHR: Character string of any length, but has to be declared with a minimum of 256 characters. Fields of this type must be located at the end of transparent tables (in each table there can be only one such field) and must be preceded by a length field of type INT2. If there is an INSERT or UPDATE in ABAP programs, this length field must be filled with the length actually required. If the length field is not filled correctly, this may lead to a data loss in the LCHR field! A fields of this type cannot be used in the WHERE condition of a SELECT statement.
    If error message wasn't clear enough, then try a where-used in transparent table of the data element AD_URI.
    NB: You could also use in your development the central address, actual URL would be stored in ADR12 and only ADRNR is in your custom database table, more development (look for BAPI BUPA) but smaller database.
    Regards,
    Raymond

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

    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 CREATION_DATE and the local time (US/EASTERN) is greater than 15 minutes. And, I'd like the output to show the values for the elapsed time in days, hours, minutes, and seconds.
    Edited by: user12301147 on Dec 2, 2009 9:16 AM

    Hi,
    It looks like to have to adjust for time zones.
    I'm not sure what you mean by "2009-DEC-02 13:59:34.316, which is in actual time 2009-DEC-02 08:59:34.316." Aren't both actual times, just in different time zones? I'm also a lttle confused about the results: even if it's treating 6 hours 18 minutes as 0 hours 18 minutes, either way it's over 15 minutes.
    Convert either creation_date or SYSTIMESTAMP to the time zone of the other. (It looks like SYSTIMESTAMP is indeed Eastern Time, UTC - 5:00).
    Or, if they are always a fixed time apart, build that difference into the comparison. for example:
    WHERE SYSTIMESTAMP - creation_date > TO_DSINTERVAL ('-0 05:45:00')

  • Multi instance of timestamp field in single table?

    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 was being done?
    UT1 > set echo on
    UT1 > @t13
    UT1 > create table marktest2 (
      2   fld1 number, fld2 varchar2(10), fld3 timestamp, fld4 timestamp)
      3  /
    Table created.
    UT1 > desc marktest2
    Name                                      Null?    Type
    FLD1                                               NUMBER
    FLD2                                               VARCHAR2(10)
    FLD3                                               TIMESTAMP(6)
    FLD4                                               TIMESTAMP(6)Ran on 9.2.0.6 running on AIX 5.2L
    HTH -- Mark D Powell --

  • Adding a custom field to T510W table

    Hi friends
    we have a requirement in which we have add ZZTRFGR Pay group to t510w table by appending structure.
    Now How can we populate value to it? as the standard V_t510W does not allow to customize it .
    so now in the table ZZTRFGR field is remaining blank. They have proposed 3 solutions which one would be the best?
    1.SAP created an view V_T510W  and  created an table maintenance generator with more functionalities like "Delimit","Collapse" and TEXT for each field available in T510w ,for the extra field(ZZTRFGR) to bring we need to build separate module pool program with all features sap created,
    2. via LSMW to update it
    3. write a ABAP code to update via flat file?
    Which one would be easier with less effort??
    with regards
    Sony

    Hi ,
    If you want to add new filed to standard table then there is a method called append structure. By using this method you can handle this..
    For more info go through this link:[http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb61446011d189700000e8322d00/content.htm]

  • I want to update date field in oracle table using database adaptor

    Hi Guys,
    I want to update date in oracle table field which is 'DATE' type , but i am getting following error.
    Pure SQL Exception.
    Pure SQL Execute of update crp3apps.IFACE_SO_DATE_CHANGES set PROCESSED_DATE=? where CTRL_ID=? failed. Caused by java.sql.SQLException: ORA-01830: date format picture ends before converting entire input string
    The Pure SQL option is for border use cases only and provides simple yet minimal functionality. Possibly try the "Perform an operation on a table" option instead.
    </summary>
    </part>
    - <part name="detail">
    <detail>
    ORA-01830: date format picture ends before converting entire input string
    </detail>
    i am formated the date using following code and assigned to one variable.
    ora:formatDate(ora:getCurrentDateTime(),'dd-MMM-yyyy hh:mm:ss ')
    this is update query
    update crp3apps.IFACE_SO_DATE_CHANGES set PROCESSED_DATE=#date where CTRL_ID=#id
    Please provide solution.
    regards
    janardhan

    The thing is that XSLT often doesn't deliver the functionality required when it comes to times.
    You suggest appening "Z" to the time but this means that the time is now in UTC time. What if the system from where the date is being converted is running in NZ using local time? Other systems that recieve the date (and correctly handle the time zone) will now have a time that is out by a number of hours.
    You often can't ignore the time zone (drop the 'Z') as if you send the time to a system it has to either assume the time is local to it (which may not be the case... the other system coudl be in a different time zone) or assume the time is UTC (I think crossfire does this by default).
    Typically can't just append a time zone (e.g. +11:00) either as many places have daylight savings so the value to appended is variable (you then need some way of determining what the value is... either Java Embedding or a Service).
    As you mention it does depend on the use case but in many circumstances using Jaba Embedding, not as suggested above but with the appropriate Java.util.Calendar classes, is the best way to handle date and time in BPEL. Even still you need to ascertain the format of times external to the system and ensure you parse them correctly.
    ANd even if you do all this you can still run into problems. I've seen a real world example where two systems which both handled time zones correctly and had previously been working together for quite a while, satrted reporting different times. It turns out that only one of them had had the most recent Java Time Zone patches applied and there had been a change in the dates for daylight savings here (Australia). Be warned!

  • To Update Custom field in mch1 table through MIGO Tcode

    Dear champs,
    I have added one custom field in mch1 table ( date ).
    Now , In MIGO Tcode when i am doing posting, MCH1 table is also updated.
    I want to know how to update my custom field in mch1 table at the time of posting.
    Please tell me where to write logic to update mch1 table.
    Regards,
    Satyen Trivedi

    Hi Satyen,
           what data has to be update in MCH1 table new field, for this did you added any screen or you want to implement your own custom logic.
    1) if you implemented the screen , then you have to write logic there itself.
    2) If you want to update through custom logic , then you takeup with the  Enhancements or BADI.
    Regards,
    Krishna

  • CMP 2 non mandatory timestamp field in Oracle 9 release 2

    Dears,
    My machine holds the following:
    Win XP pro SP 1
    Oracle 9i release 2 DB
    Jbuilder X enterprise Edition with SUN ONE App Server plugin
    SUN ONE Application server platform edition update 2
    They are all in the same machine (so there is no problem as issue 4707531 of using different Oracle drivers)
    I connect using OCI not thin.
    I got the following problem when trying to test my Session EJB that calls CMP.
    SEVERE ( 4716): EJB5071: Some remote or transactional roll back exception occurredcom.sun.jdo.api.persistence.support.JDODataStoreException: Got a JDBC SQLException.
    Please read the remaining error stack for more information.
    NestedException: java.sql.SQLException: Invalid column typeBy tracing the problem I noticed that my code works fine if I set a timestamp field in this table, this timestamp is not mandatory.
    Is it a bug in SUN ONE with Oracle 9i, or anyone have a solution?

    Hi Ash,
    Could you please verify that your .dbschmea file and table creation scripts are in sync. The easiest way to achieve this is to recapture the .dbschema file, repackage and redeploy.
    Thanks,
    Mitesh

  • Adding new custom fields in FB01

    Hello all.
    I am having a requirment as i need to add the custome fields in Fb01 transaction at item level.
    I have added the custome fields in Bseg table, now i wan to display this fields in the Fb01 screen.
    Is thios possible to do so.

    First, I hope you are using the ECC 6.0 since this is a new functionality (or ECC 5.0????). Second, tell us the steps you have followed.
    Fernando.

Maybe you are looking for