Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1296
  • Last Modified:

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'

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)".

1 Solution
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

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now