I am trying to cast a string field with a variable decimal to double. The problem I'm running into is that because the decimal is variable and can be any one of the following:
359.879999
35.8799999
3.59879999
(move the decimal wherever you want to...but the length of the field is always 9)
I have tried to do:
cast(RECURR as float) as RECURR
but that is just returning:
359.880004882813
I have tried:
cast(RECURR as decimal) as RECURR
and that returns:
360
How about trying:
select cast(recurr as decimal(19, 9))
This should be appropriate for anywhere where the decimal place lurks.
Do note that the unused decimal places will be zeroes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With