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
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')
User contributions licensed under CC BY-SA 3.0