Snowflake insert into a table from CTE output results

Viewed 1040
with 
ct2 (emp_name,emp_id) as (
  select emp_name,emp_id  
  from "TEST_1"."PUBLIC"."TEST11"
)
insert into "TEST_1"."PUBLIC"."EMP1"  
select emp_name,emp_id 
from ct2;
1 Answers

I guess you are looking for the correct syntax to achieve the above.

Try this:

insert into "TEST_1"."PUBLIC"."EMP1"
with ct2 (emp_name,emp_id) as (select emp_name,emp_id from "TEST_1"."PUBLIC"."TEST11")
select emp_name,emp_id from ct2;
Related