December 19, 2014 at 7:11 am
I have a text file and bulk insert code below:
35*20120527*WQ*1900.38~
220*20131020*QQ*454~
BULK INSERT TEST
FROM 'c:\test.TXT'
WITH
(
FIELDTERMINATOR = '*',
FIRSTROW = 1,
ROWTERMINATOR = '~'
)
But got an error as below. How to fix it?
Msg 4832, Level 16, State 1, Line 1
Bulk load: An unexpected end of file was encountered in the data file.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
December 19, 2014 at 9:00 am
This example works fine for me. My guess is the actual file you are trying to import has some hidden characters which is causing this. See if you can import the file I attached. If this does work for you, you can check for hidden characters with notepad++. is it possible for you to attach you original file?
December 19, 2014 at 9:07 am
this looks like it's from an EDI file, and the problem with EDI, is fields are optional...i doubt very much that your file has exactly four fields through the whole thing.
you've probably got some rows with 4 items, and others with 10, so it fails on a row that doesn't match the critieria.
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply