Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9189421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:13:59+00:00 2026-06-17T20:13:59+00:00

I am writing a small application which handles Tasks for people. Very simple, but

  • 0

I am writing a small application which handles Tasks for people. Very simple, but the area I am stuck on, as far as table design goes, is the case of a recurring task, which can be either once off, daily, weekly or monthly. If weekly, it’s on a specific day, weekly. Monthly is a specific day.

I have a tasks table, and a recurring_type_id, and was going to handle the recurring tasks in code, but is the the ideal way? The other way is to insert all the tasks when the task is created – for each event time. But that doesn’t seem right either.

Can anyone advice on a design and how to handle this in a maintainable and efficient way?

I’m using SQL Server 2008 R2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:14:00+00:00Added an answer on June 17, 2026 at 8:14 pm

    I would create a task table to insert my tasks into.

    taskTable
    |taskID  |Freq   |runAt       |
    -------------------------------
    |1       |daily  |1           |
    |2       |daily  |0           |
    |3       |weekly |5           |
    |4       |weekly |1           |
    |5       |monthly|15          |
    |6       |monthly|1           |
    |7       |once   |2013-7-4    |
    

    runAt for dailies is not ever considered so it doesn’t matter what value is entered.

    runAt for weekly items is the day of the week that the task is to run.

    runAt for mothly is the day of the month that the task is to run (month end tasks I usually run on the first since is saves the hassle of dealing with which day the month ends on although you could use this to figure that out

    lastDayOfMonth = datePart(d,dateadd(s,-1,dateadd(mm, datediff(m,0,getdate())+1,0)))
    

    runAt for once is the actual day the task is to run.

    Then I’d create a task to run daily to see what needed to be run.

    select  taskID
    from    taskTable
    where   (freq = 'once' and runAt = convert(varchar(10),getDate(),21))
      or    freq = 'daily'
      or    (freq = 'weekly' and runAt = datePart(dw,getDate()))
      or    (freq = 'monthly' and runAt = datePart(d,getDate())
    

    This query gives me all the taskID for any tasks that I need to run.

    Not sure if this is what you were looking for but hopefully you’ll find something useful in it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a small application which exposes a simple REST-ish HTTP API. I'm stuck
I'm writing a small application which needs to perform a common task on a
I am writing a number of small, simple applications which share a common structure
I'm writing a small application in C that reads a simple text file and
I'm writing a small application which updates my AD with info from a DB
I'm writing an small software that will be part of an existing application which
I am writing a small application in Classic ASP. I have a page which
I am writing a small web application for Windows Azure, which should use the
I am writing this small code which is part of my Django application. It
I'm writing a small audio application (in Silverlight, but that's not really relevant I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.