Incorrect SQL Syntax for Snowflake Task

I’m trying to run the following snowflake task but I’m getting this error:

SQL compilation error: syntax error line 2 at position 2 unexpected ‘COPY’.

Does anyone know what the issue could be?

CREATE TEMPORARY TABLE SCM.FACT.TEMP_TABLE AS SELECT * FROM SCM.FACT.LB WHERE 1 <> 1
COPY INTO @SCM.FACT.STAGE_RAW/LB_EXTRACT.PARQUET FROM (
SELECT 
      *
      FROM 
          SCM.FACT.LB )
FILE_FORMAT = (TYPE = 'PARQUET')
HEADER = TRUE
SINGLE = TRUE
OVERWRITE=TRUE
MAX_FILE_SIZE=5363709120

>Solution :

That looks like two separate commands to me. Try putting a semicolon after each command.

CREATE TEMPORARY TABLE SCM.FACT.TEMP_TABLE AS SELECT * FROM SCM.FACT.LB WHERE 1 <> 1;
COPY INTO @SCM.FACT.STAGE_RAW/LB_EXTRACT.PARQUET FROM (
SELECT 
      *
      FROM 
          SCM.FACT.LB )
FILE_FORMAT = (TYPE = 'PARQUET')
HEADER = TRUE
SINGLE = TRUE
OVERWRITE=TRUE
MAX_FILE_SIZE=5363709120;

Leave a Reply