469,276 Members | 1,932 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,276 developers. It's quick & easy.

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(currenttime).

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
Mar 16 '15 #1
0 1332

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.