convert to number type without losing precision

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
sangi1981
Participant
Posts: 99
Joined: Fri Jun 13, 2008 8:10 am

convert to number type without losing precision

Post by sangi1981 »

Hi,
I have a problem with the rounding of floating point numbers.
I read numbers from a file, such as 0.0000295710, 24861.19, and 116342.61, which transformer converts into a numeric type. I simply map field from varchar to float/double, without using any function.
The problem is that if I use float or double type values are rounded. If I use the decimal type, appear before the number so many zeros as they serve to fill the field.
What is the proper way to convert a field to numeric type without losing precision?
These values will be loaded into a sqlserver DB.

Thanks in advance
saraswati
Premium Member
Premium Member
Posts: 149
Joined: Thu Feb 28, 2008 4:25 pm

Post by saraswati »

Can anyone help on this one?

I am facing the same problem.
sangi1981
Participant
Posts: 99
Joined: Fri Jun 13, 2008 8:10 am

Post by sangi1981 »

Hi,
I experimented that data mapped within transfomer from varchar to double seem to be truncated viewing that from ds viewer, but in sqlserver tables they are correctly conformed to input.

By my experience, float sqlserver must be mapped to double (dfloat) datastage type.
Otherwise if you map to float ds you obtain data not correctly rounded.

Good luck
Post Reply