There is very little documentation about escaping characters in SQL Server BULK INSERT files.
The documentation for BULK INSERT says that the operator has only two formatting options: FIELDTERMINATOR and ROWTERMINATOR , however it does not say how you should avoid these characters if they appear in the value of a string field.
For example, if I have this table:
CREATE TABLE People ( name varchar(MAX), notes varchar(MAX) )
and this single row of data:
"Foo, \Bar", "he has a\r\nvery strange name\r\nlol"
... what its corresponding massive insert file looks like, because it will not work for obvious reasons:
Foo,\Bar,he has a very strange name lol
SQL Server says it supports \r and \n , but doesnβt say if backslashes escape, and does not mention the value of the field (for example, with double quotes or dropping double quotes), so I'm a little perplexed in this area.
source share