UPDATE a year from an ISO date field using SQL
5 pts.
0
Q:
UPDATE a year from an ISO date field using SQL
Dear Sir/Madam, How can I update the year from a date field. For example the date file contains '2008-12-31' and I would like to use I-Series navigator's SQL to update the date field above with '2007-11-31'.But my intention for the update here is to decrease/deduct the year by 1 year and the month by 1 month as well as there could be thousands of different date which i cannot update one by one. The date field is in ISO format. Thanks and Best Regards, Kenny Ng

Software/Hardware used:
AS/400 I-Series navigator SQL
ASKED: Aug 25 2009  9:33 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
24520 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
We need more specificity -- is your field a date type?

If the date that you have is a date type then I think this will work.
If you have a date in a char or numeric field then it needs more work.

Make a test file and try this. It should update all records in MyFile reducing MyDate


Update Myfile
Set MyDate = MyDate - 1 YEAR - 1 MONTH;

It should reduce the date by 1 year and to the same date one month before .. if the date exceeds the number in the month then the last day of the month.

Phil
Last Answered: Aug 25 2009  1:24 PM GMT by Philpl1jb   24520 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0