Bulk Insert
Translation reference for the Bulk Insert statement.
Some parts in the output code are omitted for clarity reasons.
The direct translation for BULK INSERT is the Snowflake COPY INTO statement. The COPY INTO
does not use directly the file path to retrieve the values. The file should exist before in a STAGE. Also the options used in the BULK INSERT
should be specified in a Snowflake FILE FORMAT that will be consumed by the STAGE
or directly by the COPY INTO
.
To add a file to some STAGE
you should use the PUT command. Notice that the command can be executed only from the SnowSQL CLI. Here is an example of the steps we should do before executing a COPY INTO
:
As you see in the code above, SnowConvert identifies all the BULK INSERTS
in the code, and for each instance, a new STAGE
and FILE FORMAT
will be created before the copy into execution. In addition, after the creation of the STAGE
, a PUT
command will be created as well in order to add the file to the stage.
The names of the generated statements are auto-generated using the current timestamp in seconds, in order to avoid collisions between their usages.
Supported bulk options
SQL Server
Snowflake
FORMAT
TYPE
FIELDTERMINATOR
FIELD_DELIMITER
FIRSTROW
SKIP_HEADER
ROWTERMINATOR
RECORD_DELIMITER
FIELDQUOTE
FIELD_OPTIONALLY_ENCLOSED_BY
Related EWIs
Last updated