开发者

Why is this SSIS package throwing conversion errors?

When I run it I get the following error:

Error at Data Flow Task [SQL Server Destination [164]]: The column "S开发者_高级运维epticSystemType" can't be inserted because the conversion between types DT_NTEXT and DT_WSTR is not supported.

But according to this diagram that cast is legal:

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

Am I missing something?


Here is a possible option. You could use Data Conversion Transformation task available in Data Flow Task to convert input from one data type to another. Following example shows how this can be done.

Step-by-step process:

  1. Create two tables named dbo.DataNText and dbo.DataUnicode as shown in screenshots #1 and #2.
  2. Create a package with one data flow task. Configure data flow task with a OLE DB soruce, Data Conversion task and OLE DB destination. Refer screenshot #6 to see how the tasks are configured. NText is a OLE DB source task; Conversion is a Data Conversion Transformation task; and Unicode is a OLE DB destination task.
  3. NText is configured to retrieve data from table dbo.DataNText. Column mapping is done as shown in screenshot #3.
  4. Conversion task is configured as shown in screenshot #4. Select the column to convert, provide a name to the output column. Usually it is named as Copy of. Change the data type to Unicode String [DT_WSTR] and provide a length 255. These values are for this example to show how the conversion configuration is done.
  5. Unicode is configured to save data to the table dbo.DataUnicode. Column mapping is done as shown in screenshot #5.
  6. Sample package execution is shown in screenshot #6.
  7. Sample data contents of both the tables are shown in screenshot #7.

This can also be achieved using Derived Column Transformation task.

Hope that helps.

Screenshot #1:

Why is this SSIS package throwing conversion errors?

Screenshot #2:

Why is this SSIS package throwing conversion errors?

Screenshot #3:

Why is this SSIS package throwing conversion errors?

Screenshot #4:

Why is this SSIS package throwing conversion errors?

Screenshot #5:

Why is this SSIS package throwing conversion errors?

Screenshot #6:

Why is this SSIS package throwing conversion errors?

Screenshot #7:

Why is this SSIS package throwing conversion errors?


Just under that diagram, it also says that casting to DT_WSTR requires parameters. Are you following that?

(DT_WSTR,20) casts 20 byte pairs, or 20 Unicode characters, to the DT_WSTR data type.

edit: Please see Siva's answer for steps to achieve this with another task.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜