Joanna
Joanna

Reputation: 54

ADF - VARCHAR column unwanted date time conversion

I have a copy activity in Azure Data Factory that takes the output of a procedure and saves the data to CSV file. The procedure returns VARCHAR columns and the mapping is set from VARCHAR to String.

The issue I'm having is with the date format. The procedure returns the data as YYYY-MM-DD HH:MM:SS but the output file has a format for example Jul 16 2020 12:00AM. I can't seem to figure out why and how the format is changed. It should return the VARCHAR value and not transform the date format.

Please help.

Upvotes: 0

Views: 344

Answers (2)

Arulmouzhi
Arulmouzhi

Reputation: 2254

If you change the output of a procedure like below, it might work.

use FORMAT function like below over datetime column:

Procedure Code:

enter image description here

ADF:

enter image description here

CSV File in Blob/ADLS Gen 2: enter image description here

Upvotes: 1

Himanshu Kumar Sinha
Himanshu Kumar Sinha

Reputation: 1776

Not sure if yoyu have access to update the proc , if you have you can update this to something similar

Create proc spit_dateAsVarchar 
as 
select convert(varchar,getdate()) as 'DateVarchar'

TO

select convert(datetime,convert(varchar,getdate())) as 'DateAsDateTime'

Upvotes: 1

Related Questions