简体   繁体   English

从MySQL导入SQL Server时SSIS中的绑定错误

[英]Binding errors in SSIS when importing from MySQL into SQL Server

I am pretty new to SSIS and have inherited a very simple package that imports data from a MySQL database into a SQL Server table (OLE DB Destination). 我对SSIS还是很陌生,并且继承了一个非常简单的程序包,该程序包将数据从MySQL数据库导入SQL Server表(OLE DB目标)。 The MySQL developer gave me a new query to use in place of the one currently used in the Data Flow Component (ADO.NET Source) which allegedly provides the same output columns as before. MySQL开发人员给了我一个新查询,以代替当前在数据流组件(ADO.NET源)中使用的查询,该查询据称提供与以前相同的输出列。 I simply pasted it into the SqlCommand field in place of the existing query. 我只是将其粘贴到SqlCommand字段中,以代替现有查询。 But when I execute the package, I get five errors: 但是,当我执行程序包时,出现了五个错误:

Error: 0xC002F445 at Data Import, OLE DB Destination [202]: An error occurred while setting up a binding for the "Column1" column. The binding status was "DT_NTEXT".
Error: 0xC002F446 at Data Import, OLE DB Destination [202]: An error occurred while setting up a binding for the "Column2" column. The binding status was "DT_NTEXT". The data flow column type is "DBBINDSTATUS_UNSUPPORTEDCONVERSION". The conversion from the OLE DB type of "DBTYPE_IUNKNOWN" to the destination column type of "DBTYPE_WVARCHAR" might not be supported by this provider.
Error: 0xC002F445 at Data Import, OLE DB Destination [202]: An error occurred while setting up a binding for the "Column3" column. The binding status was "DT_TEXT".
Error: 0xC002F445 at Data Import, OLE DB Destination [202]: An error occurred while setting up a binding for the "Column4" column. The binding status was "DT_TEXT".
Error: 0xC002F445 at Data Import, OLE DB Destination [202]: An error occurred while setting up a binding for the "Column5" column. The binding status was "DT_NUMERIC".

I am using SSIS in SQL Server 2012 SP1. 我在SQL Server 2012 SP1中使用SSIS。 Note that the AllowImplicitStringConversion is set to True in the ADO.NET Source. 请注意,在ADO.NET源中,AllowImplicitStringConversion设置为True。 I had the MySQL developer give me a CSV of the result of running the query directly in MySQL so I could see what the data actually looks like. 我让MySQL开发人员为我直接在MySQL中运行查询的结果提供了CSV,以便我可以看到数据的实际外观。

  1. For the first error (0xC002F445 for Column1), the DataType is Unicode text stream [DT_NTEXT] for both the External Columns section and the Output Columns section, and the destination SQL Server table is expecting an NVARCHAR(max) . 对于第一个错误(列1为0xC002F445),对于“外部列”部分和“输出列”部分,数据类型均为Unicode文本流[DT_NTEXT] ,并且目标SQL Server表期望使用NVARCHAR(max) What binding problem might I have? 我可能会有什么约束性问题?
  2. For the second error (0xC002F446 for Column2) first, the DataType is Unicode text stream [DT_NTEXT] for both the External Columns section and the Output Columns section, and the destination SQL Server table is expecting an NVARCHAR(15) . 对于第二个错误(对于Column2首先为0xC002F446) ,对于“外部列”部分和“输出列”部分,数据类型均为Unicode文本流[DT_NTEXT] ,并且目标SQL Server表期望使用NVARCHAR(15) The result set in the CSV has 'NULL' in this column for every row. CSV中的结果集在此列中的每一行都为“ NULL”。 I don't see why there is a problem, as we are trying to insert 4 characters into a 15 character column. 我不明白为什么会出现问题,因为我们试图在15个字符的列中插入4个字符。
  3. The next two columns have Unicode string [DT_WSTR] for both the External and Output types, and a TEXT type in the destination. 接下来的两列具有用于外部和输出类型的Unicode字符串[DT_WSTR] ,以及位于目标中的TEXT类型。
  4. The last column is numeric [DT_NUMERIC] for both the External and Output types, and a NVARCHAR(MAX) type in the destination. 对于外部和输出类型,最后一列是数字[DT_NUMERIC] ,而在目标位置中,它是NVARCHAR(MAX)类型。 Given that , I don't see why this is a problem. 鉴于此,我不明白为什么这是一个问题。

Can anyone provide some guidance as to how I can resolve these issues? 谁能提供一些有关如何解决这些问题的指导?

By the way, what is the [202] in each error telling me? 顺便说一句,每个错误中的[202]告诉我什么?

Had a similar problem when importing from an Excel file (Excel source) into OLE DB Destination, which gave me an error message like yours. 从Excel文件(Excel源)导入OLE DB目标时遇到了类似的问题,这给了我类似您的错误消息。 It occured when there was a column in my Excel file that had more than 255 characters, which my package couldn't handle. 当我的Excel文件中有超过255个字符的列时,就会发生这种情况,而我的包无法处理。

The solution for me was to just export the columns to a text file and import that instead. 对我来说,解决方案是将列仅导出到文本文件,然后导入。

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

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