kevchadders
kevchadders

Reputation: 8335

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

in this SO question the OP wanted to drop the 0's in the decimal places for his results. Now the example I gave (below) to get around this was to CAST with DECIMAL, then CAST with FLOAT.

e.g.

SELECT CAST(0.55 AS FLOAT)

Using the example above and running it in SQL Server 2005/2008 would seem to bring up the correct result of 0.55. But as Peter in the other post pointed out, running it in SQL Server 2000 produces 0.55000000000000004.

So my questions are:

Thanks for your time.

Upvotes: 1

Views: 2764

Answers (1)

Rubens Farias
Rubens Farias

Reputation: 57956

My personnal golden rule is: avoid float. I can't remember myself using float in recent years.

All business scenarios I took recenty I had to store currency values, or even numbers with a fixed precision, so I prefer to use DECIMAL or MONEY.

Upvotes: 1

Related Questions