Knowledge Base

How do I define a LOAD CSV FIELDTERMINATOR in hexidecimal notation

When using LOAD CSV one can define the field delimiter used, whereby the default is the ',' character.

If you want to override the default this can be accomplished via the paramter FIELDTERMINATOR, for example

LOAD CSV WITH HEADERS from 'file:///actors.csv' as row
FIELDTERMINATOR ';'
RETURN row.name;

will read a file named actors.csv and expect each field is delimited by the semi-colon character ';'

One can also define the FIELDTERMINATOR as a hexidecimal representation of its ASCII character. This can be helpful if you have chosen a field delimiter as a non-printable character, for example:

LOAD CSV WITH HEADERS from 'file:///actors.csv' as row
FIELDTERMINATOR '\u0080'
RETURN row.name;

the usage of '\u' as a FIELDTERMINATOR needs to be a 4 character zero padded value. In the above example the field terminator is now defined to be hexidecimal value 80, which is decimal character 128 of the ASCII extended characters and represents the cedilla character.