What's the safest way to escape data when using CSV IMPORT INTO on CockroachDB?

Viewed 22

I am using BCP with Export with " around the strings, and comma is the splitter. Curious, what is the safest way to escape data when using CSV IMPORT INTO?

1 Answers

To escape data when using CSV IMPORT INTO, you should wrap the value being imported in double quotes.

Between the double quotes, the " character also acts as an escape sequence if there is another " character.

For example, let's say you need to import the string cat,"dog

This string would be escaped by with: "cat,""dog". We wrap the string with outer " characters, and escape the inner " character with another " character.

Related