Hi,
I am passing the business date through parameter to retrieve the data from DB2 db. Now I need to subtract 1month from the date(format is like YYYYMM, Ex: 200701).
Is there any way to calculate the above one?
Thanks in advance.
Any function to subtract 1month from the given date
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi,
Actually I need to subtract one month from the date parameter(business date ex: YYYYMM or 200702) in WHERE clause in DB2 stage. We have written USER DEFINED SQL in the db2 stage.
The code is like:
Thanks in advance
Actually I need to subtract one month from the date parameter(business date ex: YYYYMM or 200702) in WHERE clause in DB2 stage. We have written USER DEFINED SQL in the db2 stage.
The code is like:
Please help to solve this issue.WHERE ACG_CGY_CODE in ('31520001', '31520002') and DOC_TP = 'SV' and MSR_PRD_ID = <business date YYYYMM> - 1
Thanks in advance
Ravi
Hi,
Actually I need to subtract one month from the date parameter(business date ex: YYYYMM or 200702) in WHERE clause in DB2 stage. We have written USER DEFINED SQL in the db2 stage.
The code is like:
Thanks in advance
Actually I need to subtract one month from the date parameter(business date ex: YYYYMM or 200702) in WHERE clause in DB2 stage. We have written USER DEFINED SQL in the db2 stage.
The code is like:
Please help to solve this issue.WHERE ACG_CGY_CODE in ('31520001', '31520002') and DOC_TP = 'SV' and MSR_PRD_ID = <business date YYYYMM> - 1
Thanks in advance
Ravi
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You've made it a DB2 question - surely you should be asking it in a DB2 forum somewhere. There is a perfectly good AddMonths routine available here but, no, you want to do it in SQL. Fine, go for it: it's no longer a DataStage question.
Last edited by ray.wurlod on Sun Dec 02, 2007 10:26 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
You don't need to do the subtraction in the SQL, although I'm sure that can be done. The routines you can find here would allow you to subtract a month from the parameter before it is passed to the job.
Ask your DBA how to do that in DB2 SQL.
Ask your DBA how to do that in DB2 SQL.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers