Page 1 of 1

AsInteger conversion data issue

Posted: Sat Feb 02, 2013 12:55 am
by Roopanwita
Hi,

I have source column float datatype mapped to Integer in target. I used AsInteger function in transformer to convert Float to Integer , as without conversion job was failing as I was mapping float to Integer.

After explicitly converting Float to Integer in target table field value is coming with negative sign e.g. source value :123 target value -123.

When I searched in forum, I got a post saying it is due to data over flow.

I checked table data( length of the column) It has maximum length 10 and I am running the process with very few records, so I made sure record length <=10.

Can anyone please let me know the reason.

Thank you in advance.

Posted: Sat Feb 02, 2013 1:26 pm
by zulfi123786
if your source is truly 123 i see no reason for data overflow for integer target. Is this happening for every record ? could you share more information regarding source and target stages ? give a try by making the integer column unsigned and see what happens .

Posted: Sat Feb 02, 2013 2:27 pm
by ray.wurlod
Are you sure that the job is failing due to overflow? Or is it that you are getting a warning that mapping float to integer may cause overflow, and the actual cause of failure is something else?

Posted: Sun Feb 03, 2013 1:40 am
by Roopanwita
Thank you for response.

Yes, when I am mapping float source datatype to Integer in Target (I used a Copy stage in between) , it is giving error that, you are mapping float to int32 which might truncate data and job is failing failing. So I used AsInteger conversion .

Value in output is consistently coming negative, my question is why it is converting source value to negative value in target.

If I change target table to decimal (10,0) or float it gives proper value .

Please let me know if there is any solution of this issue.

Thanks

Posted: Sun Feb 03, 2013 7:58 pm
by ray.wurlod
Not all ten digit numbers can be integers. The largest possible signed integer is 2147483647, the largest unsigned integer is 4294967295. It's that fact that triggers the alert message. Any number larger than these will wrap around and be reported as negative. What are your actual values?

Posted: Mon Feb 04, 2013 11:20 am
by Roopanwita
Thank you for response , I changed datatype of target table from Integer to Float and it is working.

Thank you.