Found character instead of field delimiter '|' in Snowflake

Viewed 40

I have a row in my CSV file like mentioned below

"TEXT"|"123584543"||||"Sherly"||"E'Sheryl"|||"DOCT"||"DC"|||||"AC"|||||||||||

I am trying to create stage using the below query:

Create or Replace file format test_stg
type = CSV
RECORD_DELIMITER = '\n'
FIELD_DELIMITER = '|'
FIELD_OPTIONALLY_ENCLOSED_BY = '\042'
SKIP_HEADER=1
empty_field_as_null = true
ESCAPE = '"';

When I run the above query I'm getting error which I have mentioned below:

**SQL compilation error: value [\"] for parameter 'FIELD_OPTIONALLY_ENCLOSED_BY' conflict with parameter 'ESCAPE'**

When I try the below query, it is getting executed successfully.

create or replace file format test_stg1
  type = csv
  record_delimiter = '\n'
  field_delimiter = '|'
  skip_header = 1
  null_if = ('NULL', 'null')
  empty_field_as_null = true
  FIELD_OPTIONALLY_ENCLOSED_BY = '0x22';

This query gets executed successfully. But when I run the COPY command, I'm getting an unusual error - Found character instead of field delimiter '|'.

Can anyone guide in fixing this issue?

Thanks :)

0 Answers
Related