Вам нужно только указать столбцы целевой временной таблицы, соответствующие списку столбцов в операторе select.
Да, вы должны указать все имена столбцов, включая типы данных.
create table "table" ( code varchar);
insert into "table" values ('S');
insert into "table" values ('U');
insert into "table" values ('R');
select code,
case when code = 'S' then 1
when code = 'U' then 0
when code = 'R' then 4
end
from "table" r;
Create temp table temp as
select code,
case when code = 'S' then 1
when code = 'U' then 0
when code = 'R' then 4
end
from "table" r; --SQL compilation error: Missing column specification
Create temp table temp (code varchar, code_no int) as
select code,
case when code = 'S' then 1
when code = 'U' then 0
when code = 'R' then 4
end as code_no
from "table" r;
select * from temp;
Ссылка на документ: https://docs.snowflake.com/en/sql-reference/sql/insert.html#optional -параметры