• For problems such as that (and many more), it can be convenient to have a Calendar table in your database. A simple table with one row per date, showing the date (primary key) and a lot of attributes such as day of week, week number, month, fiscal year, etc etc etc.

    Such a table also makes it a lot easier to do tests for business days (excluding not only saturday and sunday but also national holidays and business-specific holidays)


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/