Re: Helllppppp on Date operations..
Posted in 1996
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
}
} Hello(or Help?),
}
} Is the first time I face DATE operations. My "problem" is
} the following:
}
} columnA is DATE
} columnB is DATE
} columnC is INTEGER
}
} columnA: is an ending date(a date when my subscription will end)
} columnB: is the day that I started the subscription
} columnC: is the duration of my subscription(expessed in months)
}
} I need to SET the value of columnA equal to:
} columnB to end of the month + columnC
}
} Example:
}
} columnA= null
} columnB= 15/01/1996
} columnC= 2 (2 months)
}
} The value of columnA should be the following:
}
} step1: bring 15/01/1996 to the end of the month. So to 31/01/1996
} step2: from the end of the month of columnA, add 2 months(value of
} columnC)
}
}
} 1-My tool is SQL on INFORMIX-SE 5.04 and INFORMIX-On Line 7.1. Can my
} problem
} be solved just with SQL?
}
} 2- Is yes, could you give me an example of the statement?
}
}
} Thanks in advance to all the persons that will answer my questions. In this
} case,
} I realy need help.
}
} Fernando
Hello Fernando,
I hope the function MDY() will solve your pbm.
The format is MDY( Month,Date,Year).
update test set f1 = MDY ( MONTH(f1)+2,31,YEAR(f1)
This update fails if any one of the parameter to MDY is not in
valid range. Obviously, you have to hard code the parameters.
If you are using ESQL/C or ONL you can pass pgm variables.
Bye.
Peter.
mpeter.muc@sni.de