Posted on 2011-10-13
Last Modified: 2012-05-12
Hi All,

I have below table say TableA :

1. Id --> '01', '02' and etc
2. FromDate (Always Monday)
3. ToDate (Always Sunday).

How could I insert it using constraint from Year 2011 to 2012.

Thank you.

Question by:emi_sastra
    LVL 142

    Accepted Solution

    you should have or use a calendar table like described here:

    from there, this will be "easy", as you can then query that table for years 2011 and 2012, taking only the "mondays", and adding up the 6 days to get the sunday following that monday

    hope this helps
    LVL 1

    Author Closing Comment

    Hi angelIII,

    I get it.

    Thank you very much for your help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
    This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now