February 11, 2015 at 3:19 am
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
🙂
February 11, 2015 at 3:26 am
Have you got a calendar table? That will make the calculation of working days much easier.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
February 11, 2015 at 3:32 am
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
🙂
February 11, 2015 at 3:43 am
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.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
February 11, 2015 at 5:53 pm
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 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
February 11, 2015 at 11:48 pm
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