In the snowflake ,Merge into when Matched then insert () values () , this is working fine but i have a case where the insert should be from select statements
Merge into when Matched then insert () select * from dummy; - but this is failing with Errors
According to the documentation, the MERGE command allows only:
INSERT [(<col_name> [, ...])] VALUES (<expr> [, ...])It does not handle the SELECT statement inside an INSERT statement, but it is possible to use a subquery in the USING clause and there you should possibly pass your SELECT and transformations, it could also be a CTE (Common Table Expressions). For example:
or with CTE expression:
Reference: MERGE, CTE