Avneesh Patel
Avneesh Patel

Reputation: 87

Snowflake insert into a table from CTE output results

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;

Upvotes: 4

Views: 10569

Answers (1)

Marcel
Marcel

Reputation: 2612

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;

Upvotes: 8

Related Questions