Holiday Calender. Second Table has calculated column which add days which are not in weekends and not in holidays

  • Hello Gentlemen

    Your kind support
    Question: to create two new tables mentioned below conditions

    Table 1 named Calendar
    Table 2 named DataBT. 

    1- Calendar table in holiday calendar from the year 2000 to the year 2050 which included, working days, holiday, national days.

    2- DataBT table should contains two columns "Date1" and "DateNote" where DataNote column is a calculated column where it adds 10 days to Date1 and displays results. I am sure if "user-defined function" is helpful to join it from the calendar table. Your kind support in this matter

    More Explaination:-
    Date1 column date type Date (Manually Entered)
    DateNote column (Auto calculated column during table creation) = Date1 + 10 working days (Condition it should not include weekends and holidays. Further if the "result" comes on the weekend it should jump to next working day. It should check holidays from calendar table)

    Kind Regards
    Az

  • awzali - Monday, December 3, 2018 11:41 AM

    Hello Gentlemen

    Your kind support in below

    Table 1 named Calendar
    Table 2 DataBT. 

    Calendar table in holiday calendar from the year 2000 to the year 2050 which included, working days, holiday, national days.
    DataBT table contains two columns "Date1" and "DateNote" where DataNote column is a calculated column where it adds 10 days to Date1 and displays results. I am sure if "user-defined function" is helpful to join it from the calendar table. Your kind support in this matter

    Date1 column date type Date
    DateNote column calculated column which is equal to Date1 + 10 working days (Condition it should not include weekends and holidays. Further if the "result" comes on the weekend it should jump to next working day. It should check holidays from calendar table)

    Kind Regards
    Az

    I cannot see a question here. What are you trying to achieve?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Phil Parkin - Monday, December 3, 2018 11:45 AM

    I cannot see a question here. What are you trying to achieve?

    Is is clear now? i have updated it need two tables to create as mentioned

  • A computed column can't access the data in another table in the computation. You need a view, table valued function or a procedure.

  • Joe Torre - Monday, December 3, 2018 1:20 PM

    A computed column can't access the data in another table in the computation. You need a view, table valued function or a procedure.

    Ok thanks, can you help me with that. I am a beginner.

  • Please post create table an inserts with sample data for both tables.

  • Calendar Table - http://www.sqlservercentral.com/articles/calendar/145206/
    That will help you get this done. Depending on your locale, this might need modifications.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply