Skip to content
Advertisement

COPY INTO Snowflake Table with Extra Columns

I’ve got a table defined in Snowflake as:

GLPCT

and a file that looks like this:

GLPCT.csv

example:

My copy into command looks like this:

Problem

Snowflake is throwing an error due to a column number mismatch. How can I get Snowflake to ignore the column that isn’t present in the file and not throw an error? I can move BATCH_KEY to the end of the table if that will help.

Advertisement

Answer

It appears it’s possible to indicate what columns to insert into with a COPY INTO statement, so ours becomes:

We could not use a transformation as mentioned in a previous answer, due to this being an external file.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement