简体   繁体   English

在SSIS中将Nvarchar(max)源数据转换为varchar(max)目标

[英]Converting Nvarchar(max) source data to varchar(max) destination in SSIS

I am trying to move the data from nvarchar(max) column in sql table to varchar(max) column of another sql table in SSIS package. 我试图将数据从sql表中的nvarchar(max)列移动到SSIS包中另一个sql表的varchar(max)列。 It keeps giving me error at data conversion transformation of truncation. 它在截断的数据转换转换时一直给我错误。

I have two data conversion transformation: 我有两个数据转换转换:

  1. one converts Unicode(DT_Ntext) to Unicode(DT_WSTR)(4000) 一个将Unicode(DT_Ntext)转换为Unicode(DT_WSTR)(4000)
  2. and second data conversion transformation converts Unicode(DT_Wstr) to String(dt_str) with 4000 length 第二个数据转换转换将Unicode(DT_Wstr)转换为长度为4000的String(dt_str)

In the OLEDB Source use an SQL command as access mode an cast column within the query: 在OLEDB源中,使用SQL命令作为访问模式,在查询中使用转换列:

Select CAST([column] as varchar(max)) FROM Table

When casting within SQL command there is no need to use Data Conversion Transformation in the Data Flow Task 在SQL命令中进行转换时,无需在数据流任务中使用数据转换转换

In case that it is not a truncation error 如果它不是截断错误

If CAST() didn't works it means that the column contains some unicode characters which cannot be converted to a non unicode string, you can handle these values via the Error Output if you are using a Data Conversion Transformation or you can refer to one of the following links: 如果CAST()不起作用,则表示该列包含一些无法转换为非unicode字符串的unicode字符,如果使用数据转换转换,则可以通过Error Output处理这些值,或者可以参考一个以下链接:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM