rounding issue while loading in to sql server

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
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

rounding issue while loading in to sql server

Post by snt_ds »

Hi,

while loading the data in to sql server I am facing the below issue:


Input dataset values are 3.4455, 55.667, 333.44445

In sql server database it is loading like : 3.4400012, 55.6670122, 333.4444499999

But I need the o/p like: 3.44, 55.66,333.44 i.e i need the o/p precision 2 decimals.

And the datatype is float in the database (sql server) .

In Transformer stage i have used the decimal conversion option by giving scale 2 ,but for some of the values is loading properly, not all the records

Please advice me the handling process for above issue and any other alternative process .

Thanks in Advance
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What is your source data type, are you doing an implicit conversion to float in the transform stage?
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

Post by snt_ds »

ArndW wrote:What is your source data type, are you doing an implicit conversion to float in the transform stage?
Source datatype is Decimal and by using decode function changed to varchar and done decimal converion in transform stage
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Would it be possible to remove the character conversion from the process and stick with numeric values? This would make it simpler (and faster).
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Data types float and dfloat can not be stored accurately in digital computers. Stick with Decimal or Numeric as the data type.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply