Saturday, 15 May 2010

How Decimal places are converted using FLOAT in SQL Server 2000/2005/2008 -


In this, the OP wanted to leave 0 in decimal places for its results. Now I had to cast the example below (below) with DCIMIL, then CAST with float. Use

like

  Cast (0.55 AS Float)  

Use the example above and run it in SQL Server 2005/2008 Seems to be getting the correct result of 0.55. But as Peter said in the second post, it generates 0.550000000000004 in SQL Server 2000.

So my questions are:

  • Float should be deferred, it comes to data conversion in SQL?

  • Why cast (0.55 in the form of flaps) yields 0.5500000000000000004 in SQL2k yet 0.55 In the later editing?

  • Is Microsoft using Flat more reliable in later versions of SQL Server?

  • My personal rule is: Avoid Float In recent years, I can not use float myself.

    All the business scenarios I had taken had to store the values ​​of money either with a certain precision, so I used to DECIMAL or money .


No comments:

Post a Comment