Leading zeros issue in csv

Sharad Gawade 20 Reputation points
2024-01-08T13:56:15.8366667+00:00

Hi Team,

I am trying to load data from sql table to CSV file through ADF copy activity but after loading data into csv I can see leading zeros from all cell got removed automatically. CSV file created automatically through ADF pipeline so i can not change format to text before ingest data and at both sides source and target column type as string only.

So can you suggest any possible way to load data as it is into csv from table(including leading 0 as well)?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,625 questions
SQL Server | Other
{count} votes

Accepted answer
  1. Smaran Thoomu 24,110 Reputation points Microsoft External Staff Moderator
    2024-01-12T08:23:49.7066667+00:00

    Hi @Sharad Gawade

    Welcome to Microsoft Q&A platform and thanks for posting your question.

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others "I'll repost your solution in case you'd like to accept the answer.

    Ask: Trying to load data from sql table to CSV file through ADF copy activity but after loading data into csv I can see leading zeros from all cell got removed automatically. CSV file created automatically through ADF pipeline so i cannot change format to text before ingest data and at both sides source and target column type as string only.

    So can you suggest any possible way to load data as it is into csv from table(including leading 0 as well)?

    Solution: I found root cause of this issue. attached screenshot is for notification when I open csv and I clicked on convert and don't show option that's why it was converting into numeric value.Screenshot 2024-01-12 130619.png

    If I missed anything please let me know and I'd be happy to add it to my answer, or feel free to comment below with any additional information.

    If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.


    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Subashri Vasudevan 11,226 Reputation points
    2024-01-09T03:42:00.97+00:00

    Hi,

    Make sure you are able to see the leading zeros, in source data set data preview option.

    If source data is interpreted correctly in source data set, In your CSV sink data set setting (open the data set and find the setting) mention quote character as double quotes and try. This will maintain the data as such including leading zeros.

    Please try and let us know.

    Thanks

    0 comments No comments

Your answer

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