Can SQL Server bcp in a file with Unix line endings?

John M Gant picture John M Gant · Sep 29, 2009 · Viewed 8.2k times · Source

I'm trying to use the SQL Server bcp utility to import a text file from a samba share. bcp is choking on the Unix line endings. I'm sure I could add an intermediate step, either on Unix or Windows, to change the line endings to Windows-style. But I would prefer to import the files from Unix without modification.

Anybody know if there's a way to tell SQL Server bcp to look for Unix line endings?

Answer

Mike Flynn picture Mike Flynn · Aug 18, 2016

The simple answer is to use hex, as was mentioned in one of the comments, as the row terminator:

-r 0x0a