SSIS Convert Between Unicode and Non-Unicode Error

后端 未结 8 1904
别跟我提以往
别跟我提以往 2020-12-24 04:52

I have an ssis package where I am using an OLEDB source linking to SQL Server 2005 table. All columns except a date column are NVARCHAR(255). I am using an Excel destination

8条回答
  •  鱼传尺愫
    2020-12-24 05:01

    Instead of adding an earlier suggested Data Conversion you can cast the nvarchar column to a varchar column. This prevents you from having an unnecessary step and has a higher performance then the alternative.

    In the select of your SQL statement replace date with CAST(date AS varchar([size])). For some reason this does not yet change the output data type. To do this do the following:

    1. Right click your OLE DB Source step and open the advanced editor.
    2. Go to Input and Output Properties
    3. Select Output Columns
    4. Select your column
    5. Under Data Type Properties change DataType to string [DT_STR]
    6. Change Length to the length you specified in your CAST statement

    After doing this your source data will be output as a varchar and your error will disappear.

    Source

提交回复
热议问题