Question On SPL
Posted in 2003
Topics: Stored Procedures & SPL
Is it possible in a stored procedure to add date to some variable as a business day not the actual days. Here is an example what it should like like Suppose lv_date='2003-06-12' which is Thursday Now if we add 3 days to it then lv_date should be '2003-06-17' in place of '2003-06-15' The business days should be considered as Monday to Friday not saturday and sunday. Any ideas on this is highly appreciated. Thanks, Vineet __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com
Use SQL function weekday(date) and figure out the addition. Try > select weekday(today) from systables where tabid = 1 Sunday is zero, Thursday is 4. HTH Michael Vineet Mehrotra wrote: >Is it possible in a stored procedure to add date to >some variable as a business day not the actual days. > >Here is an example what it should like like >Suppose lv_date='2003-06-12' which is Thursday >Now if we add 3 days to it then >lv_date should be '2003-06-17' in place of >'2003-06-15' >The business days should be considered as Monday to >Friday not saturday and sunday. > >Any ideas on this is highly appreciated. > >Thanks, > >Vineet > >__________________________________ >Do you Yahoo!? >Yahoo! Calendar - Free online calendar with sync to Outlook(TM). >http://calendar.yahoo.com > >
Vineet Mehrotra wrote: > Is it possible in a stored procedure to add date to > some variable as a business day not the actual days. > > Here is an example what it should like like > Suppose lv_date='2003-06-12' which is Thursday > Now if we add 3 days to it then > lv_date should be '2003-06-17' in place of > '2003-06-15' > The business days should be considered as Monday to > Friday not saturday and sunday. > > Any ideas on this is highly appreciated. Google is your friend. Try searching in this news group for the subject "Calculate working days using stored procedure" around 29th June 1998. Or you can go to the IIUG Software Archive and look in the ESQL/C section. Either way, you can get working code - albeit some of it in ESQL/C and not SPL - which can be adapted into SPL if you want it. You could also poke around Google somewhere near the 18th May for a similar thread. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/