BULK INSERT

  • I'm trying to import data from a dat file to a table using BULK INSERT.

    USE abc

    GO

    Truncate table dbo.Det_Temp

    go

    BULK INSERT dbo.Det_Temp

    FROM 'G:\Dat file\CE2009.DAT'

    WITH (FORMATFILE = 'G:\Dat file\Det.fmt');

    GO

    But I'm getting the following error:

    Msg 4822, Level 16, State 1, Line 1

    Cannot bulk load. Invalid number of columns in the format file "G:\Dat file\Det.fmt".

    I've attached the format file by the name fmt.txt as it doesn't take .fmt format.

    Thanks

  • Try adding a carriage return at the end of the last line if there isn't one there already.

    Leo

    Leo
    Nothing in life is ever so complicated that with a little work it can't be made more complicated.

  • The format file is actually created by a developer, so I've no clue what you are trying to say..

  • Any ideas guys?

  • Can you post the table definition and some sample data we could play with?


    And then again, I might be wrong ...
    David Webb

Viewing 5 posts - 1 through 4 (of 4 total)

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