A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
Hi,@Ramkishore Kommalapudi
For your first and third issue, you can find the answers in this link mentioned by Tom.
For the fourth issue, add this to the select statement:
TheDayDiff = DATEPART(DAYOFYEAR, d)-DATEPART(DAY,GETDATE())
Finally, for your second question, I don’t quite understand. Since the first day of each month is Monday, there will always be some months that have 4 weeks, and other months that have 5 weeks. How to distinguish these months?
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.