• "Please help me to generate a Select query which can determine all Daily Schedules for current Day which might fall in any of Schedule Type and Due_Day."

    "Schedule_Type can be Weekly, Weekdays, Variable, Qtr Third Month, Qtr First Month, Number Per Week, Number Per Month, Number Per Day, Every 28 Days, Day(s) In Month(s), Day(s) EachMonth, Day(s) Each Week, Day(s) Each Month, Daily/Hourly, Daily, Bi-Weekly, Bi-Monthly, etc."

    I'm sorry. I am happy to spend a lot of time digging in to questions for people. This one is just impossible. As I said, if there's a 'number per month', given that the number of days in the month varies, it's NEVER going to divide evenly in to all months. So, how do I know which days it should run on ? What does ' Daily/Hourly' mean ? Every hour ? But, you're talking about something that is looking at days as a level of granularity, right ? What does 'Variable' mean in terms of working out what days ?

    The SQL is going to be ugly as sin, based on this awful table structure. But, for it to be even possible for someone to answer this, you need to define business rules because they are not self evident. I don't know what the correct result looks like in a lot of these cases, so I can't possibly write SQL to generate it.