sqldatetimeazure-data-factoryazure-synapse

How to avoid adf pipeline converting the date fields to datetime while writing CSV files?


I have the source from Azure synapse, where i have below query as input

select ID, cast(created_date as date) as createddate
from table

In, sink I am writing the output data to a csv file

In the output I am getting the createddate as 03-05-2024 00:00:00.0000000 where as the expected date is only 03-05-2024. Why ADF is adding the timestamp while provided input is just a date. How to fix this issue ?

I tried using format options but they are coming as string data type in the csv files like "03-05-2024" which is not again expected (expecting as date type without quotes), please help


Solution

  • I agree with @Joel Coehoorn cast created_date to varchar instead of date data type:

    select ID, cast(created_date as varchar(20) ) as createddate from  <TableName> 
    

    You will get the data as required format in csv file as shown below:

    enter image description here