Bulk Insert Huge CSV

  • Im using this command to insert a CSV file into a table:

    BULK INSERT sometable

    FROM 'c:\somefile.txt'

    WITH

    (

    FIRSTROW = 2,

    FIELDTERMINATOR = ',',

    ROWTERMINATOR = ''

    )

    The CSV file is 70MB. I cannot get the file inserted into the table because I keep getting errors like:

    Bulk load data conversion error (type mismatch or invalid character for the specified codepage)

    I think it has to do with special characters such as '/','\','-' being in the data. Is there way to structure the bulk insert statement so it wont blow up if it hits a special character?

  • Use the MAXERRORS option. Or else a Format file.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply