Home Forums SQL Server 2005 Administering Using BCP to bulk load a table. But getting garbage characters. RE: Using BCP to bulk load a table. But getting garbage characters.

  • The problem could be that the file is actually a Unicode file and you might need to use the "-w" option. Look at the first 3 bytes of the file with a hex editor. If they look like "EF BB BF", there's a pretty strong chance it's a Unicode file. XML files can be different in that they can be Unicode without that particular leader.

    When looking at the file in hex and even without the "EF BB BF" thing, if every other byte is the same ("00" for the US.English language), then it's probably Unicode.

    For more info on this subject, please see the following...

    http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8

    It could also be that someone selected some screwball code page. That's a bit more difficult to determine. The use of the RAW option (which you have) will, many times, correct that problem but you may have to use a particular code page option.

    My bet is that it's a Unicode file, though.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)