Recommand · October 22, 2021 0

Syntax error when trying to format date using not delimited (%E4Y%m%d) format

I get error Syntax error: Illegal input character "%" at [3:35] when trying to use this syntax:

WHERE _TABLE_SUFFIX = FORMAT_DATE(%E4Y%m%d, DATE_TRUNC(DATE_SUB(date_val, INTERVAL 1 MONTH), MONTH))

Also the same error for the %Y%m%d. I’m trying to get for example 20210901 for the Sep 1, 2021. Could you help with that?