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 7590073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:19:00+00:00 2026-05-30T20:19:00+00:00

Given this model: sysschedules , and assuming there were several events in the DB

  • 0

Given this model: sysschedules, and assuming there were several events in the DB with varying combinations of recurrence patterns: daily, daily every 3 days, weekly on Tues. every 2 weeks, monthly on the 28th, monthly on the second Tues of every 2 months, yearly on Feb 28th, etc…

With the model given, there are certain fields that immediately jump to mind:

  • freq_type to get whether the even is daily, weekly, monthly, etc…
  • freq_interval to determine the interval, based on the freq_type
  • freq_relative_interval to determine if events are on 1st, 2nd, 3rd, etc… of month
  • freq_recurrence_factor to determine the weekly/monthly spacing between event occurrences

If I wanted to query for all events that are today, Tuesday 28 Feb, 2012… what would that look like?

Update
Here’s what I’ve come up with so far (in this example I want all “events” that occur on Feb 28 (which is a Tues):
SELECT * FROM TableName WHERE (freq_type = 1 && active_start_date = '2012-02-28') OR (freq_type = 4) OR (freq_type = 8 && freq_interval = 4) OR (freq_type = 32 && freq_interval = 3 && freq_relative_interval = 16)

  • freq_type of 1 means it’s only once, get by the active_start_date
  • freq_type of 4 means daily, get all those since they’d occur on this day too
  • freq_type of 8 means weekly, get those events on freq_interval 4 (Tues)
  • freq_type of 32 means monthly, relative – freq_interval 3 (Tues), freq_relative_interval 16 for last

Here’s what immediately jumps to mind as “wrong“

1. What about events that are weekly, but more than one day, including Tuesday? For example, a weekly event which occurs every Tues/Thurs, will have a freq_interval of 20. How would I rewrite the query above to account for all possible combinations of freq_interval which can be Tues?

2. What about events which occur every n weeks/months? How do I know if it’s this week/month’s “on or off” time-frame?

  • 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-05-30T20:19:01+00:00Added an answer on May 30, 2026 at 8:19 pm

    Wasn’t able to fully test. This doesn’t cover every possibility. For instance, if an event happens every 3 days, some calculating will need to be done for the the dates and days, etc.

    SELECT     * 
    FROM       msdb.dbo.sysschedules 
    WHERE   (active_start_date = 20120228) 
        OR (freq_type = 4 AND freq_interval = 1)  --every day
        OR (freq_type = 4 AND freq_interval = 14 AND datename(dw, convert(datetime, convert(varchar(8), active_start_date), 112)) = 'Tuesday') --every 14 days, starting on a Tuesday
            OR (freq_type = 8 AND ((freq_interval & 4) = 4))  -- every Tuesday
            OR (freq_type = 16 AND freq_interval = 28) -- every month on the 28th
            OR (freq_type = 32 AND freq_interval = 3 
                AND (freq_relative_interval = 8 OR freq_relative_interval = 16))  -- monthly on a Tuesday of the Fourth or Last week
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given this very familiar model of prototypal construction: function Rectangle(w,h) { this.width = w;
This is just an example, but given the following model: class Foo(models.model): bar =
Given this definition: class Foo(var x: String) {} object Helper { def model[T](get: ⇒
Ok, the idea is this: Given a model such as: Release { Work[] works
Having difficulty finding relevant search results... Given this model: public abstract class A {
Given this model: from django.db import models from django.contrib.auth.admin import User # Create your
Given this model in legacy code, with RoR 2.3.11: class Assignment < ActiveRecord::Base belongs_to
What is association classes, how to implement the association classes for this given model.
Given this entity model variable: DataBaseEntities db = new DataBaseEntities (); The below code
Given this very simple model: @prefix : <http://example.org/tags#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix

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.