storing and selecting a value in real data type

  • When I try tp store .02 in my database table column which has a real datatype, its storing 1.9999999552965164E-2. But how can store it .02 instead of 1.9999999552965164E-2. Its because when I give this value to my front end programmer they are truncating it to one decimal and showing it as .019 which is a wrong value we are showing than the collected value .02 .So is there any way I can restrict storing it to .02 than 1.9999999552965164E-2.

    Any ideas would be greatly appreciated.

    Thanks.

  • Use decimal(18,2) instead.

  • From BOL: Float and real

    Approximate number data types for use with floating point numeric data. Floating point data is approximate; not all values in the data type range can be precisely represented.

    Solution :

    Use Decimal!!

     


    * Noel

  • Dam! keep typing faster than me

     


    * Noel

  • Yup.. but your solution is more detailed... so I'll let it slide this time .

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply