Float to Numeric conversion
Moderators: chulett, rschirm, roy
Float to Numeric conversion
Hello ..
Sorry to post a data type conversion questionn again.. I am facing quite a lot of data type conversion offlate. .
Here it is..
The source has the following data,
3.1120 (Float of length 10). How do i convert it to Numeric datatype of length 15?
Thanks a ton !
Sorry to post a data type conversion questionn again.. I am facing quite a lot of data type conversion offlate. .
Here it is..
The source has the following data,
3.1120 (Float of length 10). How do i convert it to Numeric datatype of length 15?
Thanks a ton !
I tried DFLOAT to Decimal conversion.. It is loading the data, but it is loading it as 10 digits after decimal, where in the input data contains only 4 digits after the decimal point.. The target column is numeric.. and the scale is 10..Is that why it is loading 10 digits??? but i am trying to populate the data whatever is coming in the input column...anbu wrote:Check DecimalToDecimal()
any thoughts on this?
Now i have changed the source field as 'Numeric' datatype,Length to 10, Scale to 15Harini wrote:Length : 15 ; Scale 10
Thanks
The target has the same datatypes and length, and scale..
When i load this i get the 3.1120000000 ( 6 zeros appended in the end) . I used Trim(columnname, "0" , "T" ) And the result is unaltered after using this function too.. Any suggesstions pls??
Thanks
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The decimal number is not stored with the trailing zeroes, it is only displayed with them. You can not get rid of them in the View Data dialog. If you want to get rid of them into a text file, declare the data type as VarChar, then Trim() will work.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sorry, am not a premium member yet. Still, the data is getting loaded with the zeros in the database. My target is SQL Server. By default the source column is read as 'float' .. I changed it to 'numeric' since the target column is also numeric..ray.wurlod wrote:The decimal number is not stored with the trailing zeroes, it is only displayed with them. You can not get rid of them in the View Data dialog. If you want to get rid of them into a text file, declar ...
Thanks
No, it's not.Harini wrote:Still, the data is getting loaded with the zeros in the database.
As noted, that is an external representation of the internal value and the viewer is "adding" the zeroes. Trimming the zeroes is a waste of time.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers