I\'m copying data from SQL to text file using bcp tool with following command:
bcp.exe \"exec \" queryout \"temp.txt\" -T -r\\n -c
There is no need to specify the record delimiter, so remove the -r\n
. The -c
option will use tab for columns and carriage return and line feed for records (same as specifying -t\t -r\r\n
). Otherwise like the other poster stated, make sure the -c
is specified first
Side note: I recommend that as a practice (not as a solution) that you output the format file using -f"yourpathandfilename.fmt"
. On the client side you use the -f
param with import as well. This way if there is a difference between the source and target you can manually tweak the format file.
I would guess the somewhere between your test environment and the client's environment's actual execution of the command that the "/n" is getting turned into a real new-line. Try putting the "-c" before the "-r" and see what happens.