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

  • 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. – AlwaysLoadingData Apr 28 '14 at 3:13
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/

|improve this answer|||||
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

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.