Discussion:
bcp out with char(10) as row terminator
(too old to reply)
Richard
2008-05-23 01:36:40 UTC
Permalink
I have to create a file that is expected to have only char(10) as a row
terminator. How can I bcp out of a table and use char(10) as a row
terminator (not char(13) + char(10) (\n or \r\n), and not just char(13)
(\r))?

Thanks
Plamen Ratchev
2008-05-23 02:41:32 UTC
Permalink
If you use BCP interactively with \n as row terminator it will automatically
prefix it with \r resulting in row terminator \r\n. But if you create a
format file and specify \n as row terminator it will work.

HTH,

Plamen Ratchev
http://www.SQLStudio.com
Richard
2008-05-28 01:53:46 UTC
Permalink
Worked like a charm. Thanks Plamen
Post by Plamen Ratchev
If you use BCP interactively with \n as row terminator it will
automatically prefix it with \r resulting in row terminator \r\n. But if
you create a format file and specify \n as row terminator it will work.
HTH,
Plamen Ratchev
http://www.SQLStudio.com
Erik Grahn
2012-05-08 13:00:56 UTC
Permalink
We encountered this problem today and got the suggestion to use ROWTERMINATOR = '0x0a' (for newline).
Post by Richard
I have to create a file that is expected to have only char(10) as a row
terminator. How can I bcp out of a table and use char(10) as a row
terminator (not char(13) + char(10) (\n or \r\n), and not just char(13)
(\r))?
Thanks
Post by Plamen Ratchev
If you use BCP interactively with \n as row terminator it will automatically
prefix it with \r resulting in row terminator \r\n. But if you create a
format file and specify \n as row terminator it will work.
HTH,
Plamen Ratchev
http://www.SQLStudio.com
Post by Richard
Worked like a charm. Thanks Plamen
Loading...