Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Inserting/updating Dynamic Date values (‘YYYY/MM’ / ‘YYYY-MM-01’ ,‘MM/01/YYYY’ )

$
0
0
Hello,

I am trying to write some DB2 queries to do following activity. Can you help me with you suggestions..

A). I need to INSERT a date in the format ‘YYYY-MM-01’ to the date field where YYYY is current year and MM is current month + 1.

Example, for today(07/18/13) it would be ‘2013-08-01’

B). I need to write a UPDATE query with SET date as ‘MM/01/YYYY’ format where YYYY is current year and MM is current month + 1.

Example, for today(07/18/13) it would be ‘08/01/2013’

C). I need to write SELECT query with WHERE clause as ‘YYYY/MM’ format where YYYY is current year and MM is current month.

Example, for today(07/18/13) it would be ‘2013/07’

Any suggestions would be appreciated. Thanks

Viewing all articles
Browse latest Browse all 13329

Trending Articles