We will see a very simple script where we will take advantage of the Common Table Expression and list all dates between two dates (Start and End Date).
SQL SERVER – SQL SERVER – Simple Example of Recursive CTE – Part 2 – MAXRECURSION – Prevent CTE Infinite Loop
Please read SQL SERVER – How to Retrieve TOP and BOTTOM Rows Together using T-SQL before continuing this article. I had asked users to come up with an alternate solution of the same problem. In this blog post we will see solution with the help of CTE.