Ukrainian character change to question mark when insert to table

后端 未结 2 1566
一个人的身影
一个人的身影 2020-12-22 04:06

I have a file saved as Unicode text containing Ukrainian characters, and it got loaded successfully to staging table using SSIS.

Like this:

\"Колодки         


        
相关标签:
2条回答
  • 2020-12-22 04:32

    Here you can see the deference between VARCHAR and NVARCHAR datatypes:

    DECLARE @Non_Unicode_Var VARCHAR (MAX) = 'Колодки тормозные дисковые, комплект';
    DECLARE @Unicode_Var NVARCHAR (MAX) = N'Колодки тормозные дисковые, комплект';
    
    SELECT @Non_Unicode_Var AS NonUnicodeColumn, @Unicode_Var AS UnicodeColumn;
    

    Result:

    +--------------------------------------+--------------------------------------+
    |           NonUnicodeColumn           |            UnicodeColumn             |
    +--------------------------------------+--------------------------------------+
    | ??????? ????????? ????????, ???????? | Колодки тормозные дисковые, комплект |
    +--------------------------------------+--------------------------------------+
    

    So, you need to change the data type to NVARCHAR data type, then insert your data into the table.

    0 讨论(0)
  • 2020-12-22 04:35

    Use nvarchar in your table and when you type your strings in the insert statement put N in front, like N'your string'. Also consider changing your collation due to sorting issues, refer to this question.

    0 讨论(0)
提交回复
热议问题