I'm elatively new to creating complicated stored procedures and need some advice please, although I'm sure that many of you won't think this complicaqted at all.
I have a Crystal report that displays a rolling 12 months woth of KPI data and I need to claculate the number of available working days per month, from the initial reporting period for 12 months. I will pass the report start date to the stored procedure and want to return 12 output variables with the correct monthly values.
I have to validate against 2 files, one which holds public holidays, the other the company working days.
The stored procedure needs to loop between 2 dates, calculate the 'Day' number for that date and see if that number record exists within the OpeningHours table. It it does, then add 1 to the correct output variable. Similarly, the actual date being looped through needs to be checked from the PublicHoliday table and if that exists. subtract 1 from the correct output variable.
My initial thought is to have the @StartMonth passed to the stored procedure then calculate the 12 periods worth of working days to pass back into the @month1, @Month2....output variables.
Can anyone please suggest where I start with this because I'm lacking a little imagination?
Many thanks
Steve
I have a Crystal report that displays a rolling 12 months woth of KPI data and I need to claculate the number of available working days per month, from the initial reporting period for 12 months. I will pass the report start date to the stored procedure and want to return 12 output variables with the correct monthly values.
I have to validate against 2 files, one which holds public holidays, the other the company working days.
The stored procedure needs to loop between 2 dates, calculate the 'Day' number for that date and see if that number record exists within the OpeningHours table. It it does, then add 1 to the correct output variable. Similarly, the actual date being looped through needs to be checked from the PublicHoliday table and if that exists. subtract 1 from the correct output variable.
My initial thought is to have the @StartMonth passed to the stored procedure then calculate the 12 periods worth of working days to pass back into the @month1, @Month2....output variables.
Can anyone please suggest where I start with this because I'm lacking a little imagination?
Many thanks
Steve