Re: Calculate working days using stored procedure
Posted in 1998
jparker@epsilon.com wrote: > > One point. > > If you have a holiday table and assuming that you have 11 holidays/year. > The total number of rows for 10 year is 110. If all you store is the date > itself that works out to a whopping total of 440 bytes. Not even worth > indexing. > > The working day math function I posted last week does so little work that > there is no real performance issue. Of course if you are doing on a couple > of million rows you might disagree. > > cheers > j. Sigh. In a generic solution, you need to store the holiday date, the country code, and maybe a boolean (char) to indicate if it is a *celebrated* holiday. You may also have some other codes. It depends on the functionality you want to offer. (Does anyone outside of FRA celebrate 14 Jul 98 as a holiday?) You may also want to expand this table to contain a description. For example, if you are a bank and you have an FX swap with a German company, you need to know that a certain date is a holiday. Your manager may want to know what holiday it is. For financial institutions, missing a holiday can be very expensive. Especially on a 50 Million Dollar swap. Or this year, Jul 3, 1998 is a holiday, or Jul 6. Since the 4th is a Sat, some companies are giving employees the 3rd or the 6th. So you may want the calendar to know this. Some companies offer floating holidays. The reason I posted the psudeo code is that for doing payment date calculations, you have to follow some very specific rules in determining the payment date. Of course will derivitives, it can get tricky because after all, they are *just* contracts ... ;-) The bottom line, is that your Holiday table gets to be a bit bigger when you put it in to perspective. The calculations are abstracted within the function calls. I left the exercise to the reader because, well, basically I'm a lazy fat slob who needs to drop 10 kgs for cycling... ;-) -Mikey -- #include <std_disclaimer.h> /* Mike Segel (MS385) */ #include <No_Spam.h> #ifdef OFFENDED_BY_CONTENT The author takes no responsibility for this post. Any resembalence to a coherent rational thought is purely coincidence. -The Management. #endif ***************************** * Attention * -*- Due to AGIS's Refusal to Act Responsibly -*- Due to ACSI's latest actions, they have been pardoned. [E.Spire] We are blocking all of their domains at the packet level. This block will exist until they modify their policies to conform to existing RFCs and net community standards. We encourage all ISPs and domain holders to do the same. *****************************