Msg 4832 Bulk load: An unexpected end of file was encountered in the data file

1

I am trying to bulk load a .csv file into SQL Server 2014 Express. Digging through StackOverflow and googling in general, everyone seems to agree that it is an issue of to few columns in the .csv file. Unfortunately none of the answers are working for me. So I can only assume that I am doing something wrong, because even my simple 2 column table I have created to test with does not work.

My test table:

CREATE TABLE [dbo].[TempC1C2]
(
    [c1] [nchar](10) NULL,
    [c2] [nchar](10) NULL
) ON [PRIMARY]

My test data:

First,Last

My load script:

Bulk Insert TempC1C2 From
'C:\test.csv'
With(datafiletype='native', FieldTerminator =',', rowterminator='\r\n', errorfile='C:\error.log')

Error.log output:

First,Last
Fi

error.log.Error.txt

Row 1 File Offset 0 ErrorFile Offset 0 - HRESULT 0x80004005
csv
sql-server-express
bulk-load
asked on Stack Overflow Aug 28, 2015 by gcryer • edited Aug 30, 2015 by gcryer

1 Answer

0

I think your rowterminator is wrong - this using \r\n:

BULK INSERT TempC1C2 
FROM 'C:\test.csv'
WITH (datafiletype='native', 
      fieldTerminator =',', 
      rowterminator='\r\n', 
      errorfile='C:\error.log')
answered on Stack Overflow Aug 28, 2015 by marc_s

User contributions licensed under CC BY-SA 3.0