SELECT * in a template?

I have three template language questions that I can't find documented anywhere.

I'm trying to compose a CTE for the following SQL. There are three things I can't get to work:

1. SELECT * - can you do that in a template?
2. QUALIFY ROW_NUMBER() OVER ... how can you use QUALIFY after the FROM
3. Forcing spaces into "expressedBy ROW_NUMBER() OVER (" - the generated SQL for this ends up being "ROW_NUMBER()OVER(" without any spaces.

SELECT *

FROM CTE_PIVOT_SOURCE

QUALIFY ROW_NUMBER() OVER (PARTITION BY account_id, IDENTIFIER_TYPE__C, EFFECTIVE_START_DATE, EFFECTIVE_END_DATE ORDER BY SYSTEMMODSTAMP DESC) = 1

1 reply