how to update current date and current time in DB2 table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AkhilaReddy
    New Member
    • Mar 2015
    • 2

    how to update current date and current time in DB2 table

    Hi Experts,

    I am new to SQL, trying to update the table with processed date (current date) and time(currenttim e).

    I am picking up the data and updating two fields processedDate (8, YYYYMMDD) and processed time(6, HHMMSS).
    Picking the data from DB2 table:
    SELECT columns FROM schema.table WHERE ProcessedDate= 0 AND processedTime= 0 ORDER BY column (orderNumber)

    Update the processedDate:
    UPDATE schema.table SET ProcessedDate=
    (SELECT YEAR (CURRENT DATE) * 10000 + MONTH(CURRENT DATE) * 100 + DAY (CURRENT DATE) FROM
    schema.table WHERE ProcessedDate= 0 FETCH FIRST 1 ROWS ONLY) WHERE ProcessedDate= 0
    I hope the above will work for processedDate (current date).
    how do we do that for processedTime?

    Thanks
Working...