Accented characters not correctly imported with BULK INSERT

前端 未结 4 2054
遥遥无期
遥遥无期 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:27

    It was answered in the comment. Did you try it?

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

    Option DATAFILETYPE ='widenative'

    Based on comment from Esailiga did the text get truncated before or after the bulk import. I agree it sounds like the CSV file itself is single byte. Unicode requires option DATAFILETYPE ='widenative'. If the CSV file is single byte the is not magic translation back.

    What is too bad is é is extended ASCII and supported with SQL char so more evidence the problem is at the CSV.
    SELECT CAST('é' AS char(1))
    notice this works as extended ASCII (<255)

    Sounds like you need to go back to the source.

    The ? in SQL is unknown. Same as � in notepad.

提交回复
热议问题