Bulk Insert Modifies Imported Character

  • I am bulk importing a list of product SKUs into a table from a csv file. I have a strange character in some SKUs

    AS-SD2PÔ0081

    and after insert the SKU in the tabe is

    AS-SD2P+0081

    Can anybody help me figure out why this character is modified and how to correct?


    Below is info that may help you help me :-).

    Table has 2 columns.

    mpSKU - varchar(50)

    qbSKU - varchar(50)

    CSV file created in excel. Looks correct opened in notepad. Only 2 columns. Sample Data:

    mpSKU,qbSKU

    AS-SD2PÔ0081,SD2P-AN

    AS-SD2PÔ0082,SD2P-AN

    AS-SD2PÔ0083,SD2P-AN

    AS-SD2PÔ0084,SD2P-AN

    My Insert Code

    BULK INSERT SKUConversion

    FROM '\\shipping\Shared\skuconversion.csv'

    WITH

    (

    FIRSTROW = 2,

    FIELDTERMINATOR = ',',

    ROWTERMINATOR = ''

    )

    Any help for this newbie would be appreciated!

    -Joe

  • I can't say I understand it, but found this fix on another forum and added to my query. It is now working! Funny how you can hunt and hunt and once you create a post, you find the answer 😀 ADDED: CODEPAGE = 'RAW'[/u]


    BULK INSERT SKUConversion

    FROM '\\shipping-pc\SkakawackSharedFolder\Shared Dejonet Docs\skuconversion.csv'

    WITH

    (

    FIRSTROW = 2,

    CODEPAGE = 'RAW',

    FIELDTERMINATOR = ',',

    ROWTERMINATOR = ''

    )

  • CodePage = 'RAW' simply supresses any codepage conversions. There's more information in Books Online on the subject under "BULK INSERT".

    --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)

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

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