Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have data extracted from SQL server DB table and when it output to CSV file using tfileoutputdelimited the leading zeros are deleted. For example '02193' becomes '2193'.
I verified that the column has a datatype of string from DB to tfileoutdelimited.
Need help on how to fix this.
Thanks,
Hema
I just opened the file and look at it.
This is what I see... It is an comma seperated excel file.
If the value coming from the DB is a String of "02193" it can only be changed to "2193" if it is converted to an int or the leading character is removed. This won't happen by accident. Can you check every component that the data passes through to ensure that everything is set to String? Maybe show us a screenshot of your job and the source and target component schemas.
Thank you for responding.
Here are the screen shots:
tdbInput:
tfileoutputdelimited:
Can you replace the tFileoutputDelimited with a tLogRow and check the output to the System.out window?
Oh, one more thought, are you reading the CSV via Excel? Could this be the formatting in Excel? Check the file using a textpad if you are using Excel.
The value read from tdbinput to tlogrow is coming out correctly as shown with the laeading zero:
I am reading the values directly from database and the schema and the screen shot is above.
Here are the settings for this tfileoutputdelimited.
Advanced settings:
How are you reading the the CSV file?
The data comes from DB query and output to CSV file.
How do you know what is in the file?
SOrry, could you clarify?
I look at the tlogrow to see what is coming from DB and look at the output file.
How do you know that the leading zeros are deleted? What software do you use to look at the CSV file?