csvdatetimeazure-data-factory

String To DateTime Error in Azure Data Factory [Type conversion settings]


I want to change my string with 28/10/2024 [dd/MM/yyyy] from .csv file to table in mssqldb and I already have mapped the columns with this picture: Mapped columns from csv to table

Problem is I was setting these for type conversion. Type conversion settings

But I got error message: ErrorCode=TypeConversionFailure,Exception occurred when converting value '28/10/2024' for column name 'DATE' from type 'String' (precision:, scale:) to type 'DateTime' (precision:255, scale:255). Additional info: String was not recognized as a valid DateTime.

enter image description here

When I setting "DateTime format" to "dd/MM/yyyy" instead of "Date format" in Type conversion settings from Data Factory, it's return that LoadDate format wrong instead of DATE.

Note my LoadDate format is "yyyy-MM-dd HH:mm:ss.fff"


Solution

  • Azure Data Factory copy activity cannot convert '10/11/2024'(string) to datetime format in SQL.

    So, use dataflow for this transformation and convert datatype string to datetime. First check whether your source and target datasets support dataflow or not.

    In dataflow, give your source and use derivedColumn transformation. When we apply date functions to this string, the dataflow also returns null. Therefore, for this, use operation on strings. I'm transforming the input data to the yyyy-MM-dd format here for example: enter image description here Add your SQL table as sink and execute it from pipeline.

    Expected result:

    enter image description here