Bulk Insert

  • Hi dear friends,

    I uploaded data on my sql server in a lacks of rows with the help of bulk insert T-SQL. After execution of my query, I checked from my table there is 10 rows are missing. How i can chek those rows which is missed or not inserted.

    Pls help me out....

    my query was like this,

    [font="Courier New"]BULK INSERT OrdersBulk

    FROM 'c:\file1.txt'

    WITH

    (

    FIRSTROW = 2,

    MAXERRORS = 0,

    FIELDTERMINATOR = ',',

    ROWTERMINATOR = ''

    )[/font]

    Thanks in Advance.

    Regards,

    M.I.

    ________________________________________
    M.I.
    [font="Times New Roman"]

    Learning is a path with no destination...
    [/font]

  • From BOL:

    ERRORFILE = 'file_name'

    Specifies the file used to collect rows that have formatting errors and cannot be converted to an OLE DB rowset. These rows are copied into this error file from the data file "as is."

    The error file is created when the command is executed. An error occurs if the file already exists. Additionally, a control file that has the extension .ERROR.txt is created. This references each row in the error file and provides error diagnostics. As soon as the errors have been corrected, the data can be loaded.

    If you had used an error file, the 10 rows that didn't make it in would be in there.

    By the way, BULK INSERT defaults to maximum errors of 10, so I'm suspicious that you even loaded the entire file. If I were you, I'd do a quick comparison between the rowcount in my table and that of the inbound file. You may need to tweak the MAXERRORS value as well.

    HTH

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

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