March 30, 2015 at 1:39 am
In My table formula(varchar) and value(Float) column.
Example
formula --> (A+B)/C
I am trying to create same expression with value
But my below example showing value gets rounded if it is big.
I am trying to do,
Declare @a float = 123456.235
SELECT CONVERT( varchar , @a) Result=>123456
any way to keep same value as It is?
March 30, 2015 at 7:29 am
umeshlade87 (3/30/2015)
ForDeclare @a float=29123455612589.23610
SELECT CONVERT(varchar(max), convert(decimal(25,5) , @a))
Result :29123455612589.23400 which is rounded again.
Did you notice it is not rounded but a different number? If rounded the last number would be 6.
I believe this is because as BOL says "Approximate-number data types for use with floating point numeric data. Floating point data is approximate; therefore, not all values in the data type range can be represented exactly."
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply