This code works perfectly in SSMS, but in Snowflake, not so much. Any suggestions on how I can fix it?
set (start_date) = ('2017-07-01');
set (end_date) = ('2022-06-30');
with get_all_dates as (
select
$start_date as DateValue
, 1 as level
union all
select
DATEADD(DAY,1,DateValue)
, level + 1
from
get_all_dates
where
Datevalue < $end_date
)
select * from get_all_dates;
This produces the following error message:
SQL compilation error: Type mismatch between anchor and recursive term of column 'DATEVALUE' in Recursive CTE 'GET_ALL_DATES'
Expected output:
2017-07-01
2017-07-02
...
2022-06-29
2022-06-30