Issue with Bulk Insert

  • On my .fmt file, I have the following code:

    8.0

    1

    1 SQLCHAR 0 255 "\t" 1 Allied Stk #

    When I try to run the following bulk insert:

    BULK

    INSERT AlliedInventorymaster

    FROM '\\cdrexch1\shared\ScannedImages\dee-elect-part.txt'

    WITH

    (

    FORMATFILE = '\\cdrexch1\shared\ScannedImages\AlliedInventoryMaster.fmt'

    )

    GO

    I get the following error:

    Cannot perform bulk insert. Invalid collation name for source column 1 in format file '\\cdrexch1\shared\ScannedImages\AlliedInventoryMaster.fmt'.

    What seems to be happening is the space that is in the column name of the .fmt file. If I replace Allied Stk # with another column in the table, URL, then it works correctly. Both fields are varchar 255 columns.

    Does anyone know how I can resolve this issue?

  • I'm not entirely sure, but to use that column from normal SQL, you'd have to delimit it with [ and ] - so maybe try that.

    Atlantis Interactive - SQL Server Tools
    My blog[/url]
    Why I wrote a sql query analyzer clone

  • I tried [] with no luck, '' with no luck, and "" with no luck so far 🙁

  • From reading this:

    http://msdn.microsoft.com/en-us/library/ms191479.aspx

    I would say you want to change 'Allied Stk #' to just 'Allied' - basically the name seems to have very little to do with it, and it's the server column order field which seems to be the important one.

    Atlantis Interactive - SQL Server Tools
    My blog[/url]
    Why I wrote a sql query analyzer clone

  • That did the trick, thanks!

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

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