代码
WITH DateSequence AS (10),'2024-01-01',120) AS DateValue
SELECT convert(char(
UNION ALL10),dateadd(day, 1, DateValue),120) AS DateValue
SELECT convert(char(
FROM DateSequence< '2024-08-13'
WHERE DateValue
)
SELECT DateValue FROM DateSequence0);-- 允许无限递归,或设置一个足够大的数字以避免栈溢出 OPTION (MAXRECURSION