Import Package Error - Cannot Convert between Unicode and Non Unicode String Data Type

前端 未结 16 905
小蘑菇
小蘑菇 2021-01-31 13:29

I have made a dtsx package on my computer using SQL Server 2008. It imports data from a semicolon delimited csv file into a table where all of the field types are NVARCHAR MAX.

16条回答
  •  感动是毒
    2021-01-31 14:05

    Sometime we get this error when we select static character as a field in source query/view/procedure and the destination field data type in Unicode.

    Below is the issue i faced: I used the script below at source

    and got the error message Column "CATEGORY" cannot convert between Unicode and non-Unicode string data types. as below: error message

    Resolution: I tried multiple options but none worked for me. Then I prefixed the static value with N to make in Unicode as below:

    SELECT N'STUDENT DETAIL' CATEGORY, NAME, DATEOFBIRTH FROM STUDENTS
    UNION
    SELECT N'FACULTY DETAIL' CATEGORY, NAME, DATEOFBIRTH FROM FACULTY
    

提交回复
热议问题