3

I'm trying to terminate each row in BCP output with a specific string along with newline. Neither of these work:

  • -r"terminator_string\n"';
  • -r"terminator_string"+\n';

Any suggestions?

For an idea of the overall problem, see https://stackoverflow.com/questions/23329028/outofmemory-exception-when-reading-and-replacing-strings-with-streamreader-and-s

asked Apr 28, 2014 at 0:31
1
  • 2
    Could you provide more detail on what you want compared to what you are getting? Are the apostrophe and semi-colon part of the code? With -c -r "test\n" I'm getting what I think you're expecting. Commented Apr 28, 2014 at 3:13

2 Answers 2

1

Use the ASCII codes of the characters you want to match (without the 0x prefix).

For example to match A (char hex 41) + LineFeed (char hex 0A) do this:

-r "410A"

This seems to be undocumented. See my blog here for more info: http://kejser.org/databases/bulk-insert-with-linux-line-endings/

answered May 3, 2014 at 8:39
0

Check Specifying Field and Row Terminators for bcp

E.g.:

-r \n -Specifies the row terminator as a newline character. This is the default row terminator, so specifying it is optional.

Hope this helps

answered Apr 29, 2014 at 23:15

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.