[英]Azure Data Factory: Wrong and unexpected Datatype conversion error during import from csv to sql server via pipeline
I am trying to load data from a csv to a SQL server database using an Azure pipeline copy data operator.It throws following error during trigger the pipeline.我正在尝试使用 Azure 管道复制数据运算符将数据从 csv 加载到 SQL 服务器数据库。它在触发管道期间引发以下错误。 In CSV file i have one date column (StatusDate) with null values when i am importing data in MS-SQL Data base table is having StatusDate is a date time column.在 CSV 文件中,当我在 MS-SQL 数据库表中导入数据时,我有一个带有 null 值的日期列(StatusDate),其中 StatusDate 是一个日期时间列。
Error msg[![Source CSV File错误消息 [![源 CSV 文件 : "Operation on target Copy data1 failed: Failure happened on 'Source' side. 'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed. Please search error to get more details.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=Microsoft.Azure.Data.Governance.Plugins.Core.TypeConversionException,Message=exception occurred when converting data from column name 'StatusDate', type 'String', value 'null' to type 'DateTime': The string was not recognized as a valid DateTime. There is an unknown word starting at index 0.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.FormatException,Message=The string was not recognized as a valid DateTime. There is an unknown word starting at index 0.,Source=mscorlib,'" :“对目标复制数据 1 的操作失败:‘源’端发生故障。‘Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=数据库操作失败。请搜索错误以获取更多详细信息。,Source=Microsoft。 DataTransfer.ClientLibrary,''Type=Microsoft.Azure.Data.Governance.Plugins.Core.TypeConversionException,Message=从列名'StatusDate'、类型'String'、值'null'到类型'DateTime'转换数据时发生异常: 字符串未被识别为有效的日期时间。从索引 0 开始有一个未知单词。,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.FormatException,Message=字符串未被识别为有效的日期时间。有一个从索引 0 开始的未知单词。,Source=mscorlib,'"
Destination Table Structure:目标表结构:
create table RepsNoLongerInDiscovery(
[CRD] [varchar](11) ,
[First] [varchar](50) ,
[Middle] [varchar](50) ,
[Last] [varchar](50) ,
[Suffix] [varchar](50) ,
[Status] [varchar](20) ,
[StatusDate] [datetime] )
I tested with copy active and it works well.我测试了复制活动并且效果很好。
My dataset:我的数据集:
Bellow is my Source:贝娄是我的来源:
Note: we must specify the column data type as DateTime
in Mapping settings :注意:我们必须在 Mapping settings 中将列数据类型指定为DateTime
:
Then run the pipeline and check the data in Sink table:然后运行管道并检查 Sink 表中的数据:
Hope this helps.希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.