How to generate with scripting INTERVAL 1 <day|week|month>?
问题 We are trying to find a syntax to generate the DAY|WEEK|MONTH options from the 3rd param of date functions. DECLARE var_date_option STRING DEFAULT 'DAY'; select GENERATE_DATE_ARRAY('2019-01-01','2020-01-01',INTERVAL 1 WEEK) dynamic param here -^^^ Do you know what's the proper syntax to use in DECLARE and that should be converted to valid SQL. 回答1: Below is for BigQuery Standard SQL Those DAY|WEEK|MONTH are LITERALs and cannot be parametrized And, as you know - dynamic SQL is also not