Share via

Date Issue

Rohit Kulkarni 731 Reputation points
2023-04-03T20:44:05.6366667+00:00

Hello Team I want to pass the date column in this format 'yyyymmdd'. I have passed this query in the lookup Activty UPDATE STG.WATERMARK SET ERDAT=formatDateTime('@{item().ERDAT}','yyyymmdd') WHERE DESTINATION_TABLE_NAME ='@{pipeline().parameters.DESTINATION_TABLE_NAME}' AND DESTINATION_TABLE_SCHEMA='S4' But the date is getting update in the column of the table 'YYYY-MM-DD' (2023-03-12). Please advise Regards Rohit

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.


1 answer

Sort by: Most helpful
  1. AnnuKumari-MSFT 34,571 Reputation points Microsoft Employee Moderator
    2023-04-05T10:31:09.3133333+00:00

    Hi Rohit Kulkarni , Thankyou for using Microsoft Q&A platform and thanks for posting your question here. As I understand your query, you are trying to update your sql table STG.WATERMARK to have data in ERDAT column in the format of yyyymmdd . In this process, the pipeline is successfully getting executed but the date column still holds the value in this format: YYYY-MM-DD . Please let me know if that's not the case.

    The issue here is datatype mismatch. The column ERDAT is of Date datatype , which is always supposed to store the data in YYYY-MM-DD format.

    It's not the issue with ADF pipeline. Even if you directly run the update query in the SQL table, you will find the same data is retaining without table getting updated . In order to store the data in any other format , kindly alter the column datatype as varchar with below command:

    ALTER TABLE STG.WATERMARK
    ALTER COLUMN ERDAT varchar(50);
    
    

    Hope it helps. Kindly accept the answer by clicking on Accept answer button. Thankyou

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.