March 5, 2008 at 2:36 pm
But doesn't the bulk insert need that marker for the end of file?
March 5, 2008 at 2:44 pm
It will. It doesnt need a blank line to end the file.
March 5, 2008 at 2:46 pm
I'm sorry, I'm confused. My txt file does contain the square bracket on the last line, is this correct or not? If it is my bulk insert is reading it in as a record, how can this be corrected?
March 5, 2008 at 2:49 pm
If you have a little square on the last line. This usually means you have a hard return. To resolve simply delete the last line. It should look blank when you open the file in notepad.
March 5, 2008 at 2:51 pm
So the bracket is really invisible to the user? It's just something SQL knows somehow?
Thanks for your patience!
March 5, 2008 at 3:05 pm
Well the little square is hard return, in this case. The hard return consists of the CR\LF characters, which is the default row terminator. SQL was thinking you had an extra row when you did not.
And yes the CR\LF is invisible when you open notepad.
March 5, 2008 at 3:18 pm
You guys are crossing your wires just a bit. If you're seeing a square bracket at the end of the text FILE, you should remove that last line. The square bracket is not the EOF marker... I guarantee it.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 5, 2008 at 5:28 pm
i've got the bracket or end-of-file issue resolved, however now I have this issue:
As stated previously, my bulk insert sp inserts records into a table from a txt file. The txt file has each record on a separate line, meaning we have \r
However, in the table the first char of the first row has a value, but all of the following records who a blank in that position. What could the issue be?
March 5, 2008 at 6:06 pm
Does the row in question contain anything else or just the one character?
It sounds like your field/column terminator is set incorrectly.
March 6, 2008 at 4:12 am
newbie (3/5/2008)
i've got the bracket or end-of-file issue resolved, however now I have this issue:As stated previously, my bulk insert sp inserts records into a table from a txt file. The txt file has each record on a separate line, meaning we have \r
However, in the table the first char of the first row has a value, but all of the following records who a blank in that position. What could the issue be?
We can only guess... if there's nothing private in the file, upload it as an attachment and let's see...
--Jeff Moden
Change is inevitable... Change for the better is not.
March 6, 2008 at 7:14 am
Unfortuanatly I cannot upload the file, however the values are similar to this example:
This is what is in the text file:
12345
54678
90876
34205
In the table, after the bulk insert, it has the first value correctly, but all the following values shift over by one and the first char is blank.
Viewing 11 posts - 16 through 25 (of 25 total)
You must be logged in to reply to this topic. Login to reply