Share via

DataType in a ForEach loop

sam nick 366 Reputation points
2021-05-03T16:08:34.073+00:00

Hello,
I currently have a pipeline that takes raw csv files from a blob and loads it into an azure sql DB. Since i have multiple different files, i am using a ForEach loop. The issue here is the datatype. The files being loaded from the blob into the DB are coming over a nvarchar(max) for all fields (even for date, int, float etc). Since its a ForEacch lop and a parameter for file (i.e childitems) , I cannot explicitly mention the mapping for each fields. Is there a way to overcome this or do i have to have a sperate flow for each file and mention the datatype for each fields.

Cheers.

Azure Data Factory
Azure Data Factory

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


2 answers

Sort by: Most helpful
  1. sam nick 366 Reputation points
    2021-05-12T01:13:43.73+00:00

    @HimanshuSinha - But how to incorporate any specific field logic i.e if a specific field in the source file has a value that needs to be updated.
    ex: if a field has 123-344-5567 then, the destination field into the DB should be 1233445567

    Was this answer helpful?


  2. HimanshuSinha 19,637 Reputation points Microsoft Employee Moderator
    2021-05-04T22:16:02.607+00:00

    Hello @sam nick ,
    Thanks for the ask and using the Microsoft Q&A platform .

    I think you are using this pipeline to copy different CSV with varied schema ,, if thats the case , I think your approach is correct . Since you are copying the data to SQL , you can add one stored proc activity and copy the data from the current table to a table with correct data type .

    Please do let me know how it goes .
    Thanks
    Himanshu
    Please do consider to click on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members

    Was this answer helpful?

    0 comments No comments

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.