How do I insert new date column like 'yyyymm' into a parquet file. : Azure Synapse Analytics

Kakehi Shunya (筧 隼弥) 201 Reputation points
2022-07-06T01:24:27.68+00:00

I have posted a question like below and it has solved.

*I am looking to insert new column into parquet file.
Now, I am tried to do that through data flow and I could insert date column.
But the date column format is not what I thought.

Now format is 'yyyy-mm-dd' and I want to transform it to 'yyyymm'.
I don't know how to do that.
If you have an answer, please tell me that.
Any help would be appreciated.*

But a new problem has occurred.

I have to change the 'MM' part of the date format.

For example, I execute pipeline on 2022-07-05(yyyy-MM-DD), I have to insert date column like '202206'.

I don't know how to solve it.

My expression is:
toInteger(subMonths(currentDate(),-1),'yyyyMM')

But it doesn't work.

Any help would be appreciated.

Thank you.

217849-image.png

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,279 questions
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,143 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,140 questions
0 comments No comments
{count} votes

Accepted answer
  1. Suba Balaji 10,936 Reputation points
    2022-07-06T06:00:25.967+00:00

    Hi @Kakehi Shunya (筧 隼弥) ,

    you can use the expression given below.

    toString(addMonths(currentDate(),-1),'yyyyMM')

    Please note that there is no SubMonths() function. Instead, you need to pass on negative numbers to addMonths().

    Hope you got it. Please try and let us know.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful