Microsoft SQL Server Bulk Insert

I am trying to do a bulk insert and SQL server database table. The code i am using is as follows.

BULK INSERT dbo.UKGeocodes
FROM 'D:\postcodes.csv'
WITH
(
FIRSTROW = 2,
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO

I know this insert works as i am using it for another process, and the Field and Row Terminators also have the correct values assigned to them for the file i am trying to insert.

The CSV file is very large with 1.9 million rows so i cannot open it up fully in Microsoft Excel and make changes to the file as the size is beyond the Excel Row limit.

These are the errors that i am getting;
Msg 4866, Level 16, State 8, Line 3
The bulk load failed. The column is too long in the data file for row 1, column 13. Verify that the field terminator and row terminator are specified correctly.
Msg 7301, Level 16, State 2, Line 3
Cannot obtain the required interface ("IID_IColumnsInfo") from OLE DB provider "BULK" for linked server "(null)".

Thanks
jonathanemersonAsked:
Who is Participating?
 
x-menIT super heroCommented:
there must be a problem with the data in the .csv file

you cane use a command prompt command to check the contents of the file

MS-DOS> more myfile.csv

PowerShell > get-content my file.csv | more
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.