I am sure that I missed something very basic, but I can not wrap it around me after a request and search for an hour.
I have an existing datetable if that helps. It is filled with the dates of past years and updated every night through a stored procedure that is launched by the task on the server.
What I need to do is pull Monday-Sunday of the week, so I can correctly join them in the tracking table to get a weekly hit chart. I don’t want to write 52 gradually larger sentences and combine them for obvious reasons, and I don’t like the idea of cursors.
I have already done this for months and days, but the nature of the weeks confuses me for some reason or is different in nature.
Any thoughts on how to automate the process without cursors or a huge selection / pool? I’ll follow the cursor and throw it on the table at night, if absolutely necessary, but I hope not.
FYI my desired format at the end of this will be:
[Week number] | [StartDate] | [EndDate]
For every week
date sql sql-server report
C bauer
source share