Thursday, March 22, 2012

BULK INSERT row terminator

Hello all,
I have a multiple text files with an odd row terminator. If you were to
examine it in VB it would be like a "CrCrLf" instead of just "CrLf". In
HEX it is DDA instead of just DA. When I am trying to import into my
table using BULK INSERT I use "\n" as the row terminator but that is
putting the the previous character into the column and then it signals
a carriage return when I attempt to query the data.

Any suggestions on what I should use as the row terminator? Is it
possible to tell BULK INSERT to use something like "CHAR(10)\n"?

"\n\n" does NOT work.

Thanks in advance.I found it!
"\r\n" works like a charm.. "\r" is for carriage return only.. I'm
surprised I didn't already know that.

I found the answer here:
http://www4.dogus.edu.tr/bim/bil_ka...l65dba/ch16.htm

under table:
Table 16.4. Valid field terminators.
Terminator Type Syntax
tab \t
new line \n
carriage return \r
backslash \\
NULL terminator \0
user-defined terminator character (^, %, *, and so on)sql

No comments:

Post a Comment