Need help

  • Need to create a function which will return the below o/p:

    The Reporting End Date Logic is : Last Day of Month + 3 Working day of next month

    Working Day : Monday till Friday

    YearMonthIdMonthReportingStartDate ReportingEndDate

    20151Jan6th Jan 4th Feb

    20152Feb5th Feb 4th March

    20153Mar5th March 3rd April

    20153Apr4th April 5th May

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂

  • Have you got a calendar table? That will make the calculation of working days much easier.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • BWFC (2/11/2015)


    Have you got a calendar table? That will make the calculation of working days much easier.

    Can you please give me a link.

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂

  • Try this one[/url] first. There's many out there so a little searching might find one that does exactly what you need. Working days vary from country to country so you might have to do a little modification first.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • rhythmk (2/11/2015)


    BWFC (2/11/2015)


    Have you got a calendar table? That will make the calculation of working days much easier.

    Can you please give me a link.

    Look at Calendar Tables in T-SQL[/url]

    There's a section on joining the Calendar table to a Holidays table, which also excludes Sat/Sun as non-working days, that could get you started.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • Thanks BWFC & Dwain.Those links were really helpful.

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂

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

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