Syntax  ¶
    /* Standard data load */
    COPY INTO [<namespace>.]<table_name>
         FROM { internalStage | externalStage | externalLocation }
    [ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
    [ PATTERN = '<regex_pattern>' ]
    [ FILE_FORMAT = ( { FORMAT_NAME = '[<namespace>.]<file_format_name>' |
                        TYPE = { CSV | JSON | AVRO | ORC | PARQUET | XML } [ formatTypeOptions ] } ) ]
    [ copyOptions ]
    [ VALIDATION_MODE = RETURN_<n>_ROWS | RETURN_ERRORS | RETURN_ALL_ERRORS ]
    /* Data load with transformation */
    COPY INTO [<namespace>.]<table_name> [ ( <col_name> [ , <col_name> ... ] ) ]
         FROM ( SELECT [<alias>.]$<file_col_num>[.<element>] [ , [<alias>.]$<file_col_num>[.<element>] ... ]
                FROM { internalStage | externalStage } )
    [ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
    [ PATTERN = '<regex_pattern>' ]
    [ FILE_FORMAT = ( { FORMAT_NAME = '[<namespace>.]<file_format_name>' |
                        TYPE = { CSV | JSON | AVRO | ORC | PARQUET | XML } [ formatTypeOptions ] } ) ]
    [ copyOptions ]
Copy
Where:
>
>     internalStage ::=
>         @[<namespace>.]<int_stage_name>[/<path>]
>       | @[<namespace>.]%<table_name>[/<path>]
>       | @~[/<path>]
>  
>
> Copy
>  
>  
>     externalStage ::=
>       @[<namespace>.]<ext_stage_name>[/<path>]
>  
>
> Copy
>  
>  
>     externalLocation (for Amazon S3) ::=
>       's3://<bucket>[/<path>]'
>       [ { STORAGE_INTEGRATION = <integration_name> } | { CREDENTIALS = ( {
> { AWS_KEY_ID = '<string>' AWS_SECRET_KEY = '<string>' [ AWS_TOKEN =
> '<string>' ] } } ) } ]
>       [ ENCRYPTION = ( [ TYPE = 'AWS_CSE' ] [ MASTER_KEY = '<string>' ] |
>                        [ TYPE = 'AWS_SSE_S3' ] |
>                        [ TYPE = 'AWS_SSE_KMS' [ KMS_KEY_ID = '<string>' ] ]
> |
>                        [ TYPE = 'NONE' ] ) ]
>  
>
> Copy
>  
>  
>     externalLocation (for Google Cloud Storage) ::=
>       'gcs://<bucket>[/<path>]'
>       [ STORAGE_INTEGRATION = <integration_name> ]
>       [ ENCRYPTION = ( [ TYPE = 'GCS_SSE_KMS' ] [ KMS_KEY_ID = '<string>' ]
> | [ TYPE = 'NONE' ] ) ]
>  
>
> Copy
>  
>  
>     externalLocation (for Microsoft Azure) ::=
>       'azure://<account>.blob.core.windows.net/<container>[/<path>]'
>       [ { STORAGE_INTEGRATION = <integration_name> } | { CREDENTIALS = ( [
> AZURE_SAS_TOKEN = '<string>' ] ) } ]
>       [ ENCRYPTION = ( [ TYPE = { 'AZURE_CSE' | 'NONE' } ] [ MASTER_KEY =
> '<string>' ] ) ]
>  
>
> Copy
>  
>  
>     formatTypeOptions ::=
>     -- If FILE_FORMAT = ( TYPE = CSV ... )
>          COMPRESSION = AUTO | GZIP | BZ2 | BROTLI | ZSTD | DEFLATE |
> RAW_DEFLATE | NONE
>          RECORD_DELIMITER = '<character>' | NONE
>          FIELD_DELIMITER = '<character>' | NONE
>          PARSE_HEADER = TRUE | FALSE
>          SKIP_HEADER = <integer>
>          SKIP_BLANK_LINES = TRUE | FALSE
>          DATE_FORMAT = '<string>' | AUTO
>          TIME_FORMAT = '<string>' | AUTO
>          TIMESTAMP_FORMAT = '<string>' | AUTO
>          BINARY_FORMAT = HEX | BASE64 | UTF8
>          ESCAPE = '<character>' | NONE
>          ESCAPE_UNENCLOSED_FIELD = '<character>' | NONE
>          TRIM_SPACE = TRUE | FALSE
>          FIELD_OPTIONALLY_ENCLOSED_BY = '<character>' | NONE
>          NULL_IF = ( '<string>' [ , '<string>' ... ] )
>          ERROR_ON_COLUMN_COUNT_MISMATCH = TRUE | FALSE
>          REPLACE_INVALID_CHARACTERS = TRUE | FALSE
>          EMPTY_FIELD_AS_NULL = TRUE | FALSE
>          SKIP_BYTE_ORDER_MARK = TRUE | FALSE
>          ENCODING = '<string>' | UTF8
>     -- If FILE_FORMAT = ( TYPE = JSON ... )
>          COMPRESSION = AUTO | GZIP | BZ2 | BROTLI | ZSTD | DEFLATE |
> RAW_DEFLATE | NONE
>          DATE_FORMAT = '<string>' | AUTO
>          TIME_FORMAT = '<string>' | AUTO
>          TIMESTAMP_FORMAT = '<string>' | AUTO
>          BINARY_FORMAT = HEX | BASE64 | UTF8
>          TRIM_SPACE = TRUE | FALSE
>          NULL_IF = ( '<string>' [ , '<string>' ... ]