Microsoft SQL Server Bulk Insert

Posted on 2012-09-04
Last Modified: 2012-09-27
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)".

Question by:jonathanemerson
    1 Comment
    LVL 18

    Accepted Solution

    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

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

         When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
    In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now