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?
Asked
Active
Viewed 55 times
3

mo lawler
- 41
- 1
1 Answers
2
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.

Thomas
- 61
- 3