One Star

Data Truncated Error During Insert

I have a MySQL DB table with a variety of data types, but I am having trouble in particular with currency. I have tried changing the data type at the DB level and in Talend scripting to Float, Int, Decimal and most recently, Double. All data types have produced errors. Double is producing a "Data truncated for column 'Charges' at row 1".
What is the best data type to use for currency (need for sorting) and how can I get talend to insert the data?
Thanks
Jeff
3 REPLIES
Moderator

Re: Data Truncated Error During Insert

Hi,
We have designed a demo job, you can take it into consideration. We set the data type of currency as "String" . see the pic to get the details.

Best Regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Data Truncated Error During Insert

String works for the insert, but if you intend to sort your results by currency at the application side, it will sort as:
0.67
1.24
10.23
107.76
2.54
20.45
200.45
3.76
and on and on. Setting as an integer, float, double, decimal will allow sorting by true numeric value.
Moderator

Re: Data Truncated Error During Insert

Hi,
Set the data type as Float and give a length to it.
What is the best data type to use for currency (need for sorting)

See pics
Best Regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.