Reputation: 85126
When I run it I get the following error:
Error at Data Flow Task [SQL Server Destination [164]]: The column "SepticSystemType" 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?
Upvotes: 3
Views: 15673
Reputation: 38526
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.
Upvotes: 1
Reputation:
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:
dbo.DataNText
and dbo.DataUnicode
as shown in screenshots #1 and #2.NText
is a OLE DB source task; Conversion
is a Data Conversion Transformation task; and Unicode
is a OLE DB destination task.dbo.DataNText
. Column mapping is done as shown in screenshot #3.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. dbo.DataUnicode
. Column mapping is done as shown in screenshot #5.This can also be achieved using Derived Column Transformation
task.
Hope that helps.
Screenshot #1:
Screenshot #2:
Screenshot #3:
Screenshot #4:
Screenshot #5:
Screenshot #6:
Screenshot #7:
Upvotes: 6