Accented characters not correctly imported with BULK INSERT

前端 未结 4 2010
遥遥无期
遥遥无期 2021-01-15 05:22

I am importing a source CSV file, I don\'t know the source encoding and I can only see either � (ANSI encoding) or (UTF8-without-BOM encoding)

4条回答
  •  一生所求
    2021-01-15 05:42

    In my case I can fix the encoding problem with the CODEPAGE option:

    BULK
    INSERT #CSV
    FROM 'D:\XY\xy.csv'
    WITH
    (
       CODEPAGE = 'ACP',
       DATAFILETYPE ='char',
       FIELDTERMINATOR = ',',
       ROWTERMINATOR = '\n',
       FIRSTROW = 2
    )
    

    Possible values: CODEPAGE = { 'ACP' | 'OEM' | 'RAW' | 'code_page' } ]

    You can find more information about the option here: BULK INSERT

提交回复
热议问题