Generate Series of Dates in Snowflake
As Snowflake doesn't have a native generate_series function, here is our solution to generating a table of incrementing dates, starting from the current date, in Snowflake. It is currently set to generate 1095 rows (3 years) of dates.
select dateadd(day, '-' || seq4(), current_date()) as dte from table (generator(rowcount => 1095))
Thank you! This worked great. I'm also trying to generate the same table but starting with a date in the future. I've tried:
dateadd(day, '-' || seq4(), 2030-01-01 as dte
(generator(rowcount => 7300))
But that didn't work. Also tried it without "as dte" but that didn't work either. I'm a total beginner in SQL since I work with databases only through a GUI. I'd really appreciate any explanation of why the replacement I tried did not work, and what to try instead.Reply