snowflake-cloud-data-platformparquet

how can i Copy Into from more than one Table ?? Snowflake


with this line i will get the data2016 but what if i have a multiple years data (2017, 2018, 2019 ...) how can write the statment

COPY INTO "DATA_HUB_DEV"."STAGE"."mytable" ("/BIC/ZDBTVABIS")
FROM (
  SELECT $1:"/BIC/ZDBTVABIS"
  FROM  @STAGE_DATA_LAKE_RAW/data2016
);

thanks


Solution

  • Assuming they are all in a different folder under your stage, you could simply remove the folder from your stage path and use a PATTERN to grab the files underneath it.

    There are some good examples in the documentation link here:

    https://docs.snowflake.com/en/sql-reference/sql/copy-into-table.html#loading-using-pattern-matching