Problem in Inputing/Updating float value in SQL Server

I'm trying to update float values in SQL Server2000 using PreparedStatement with setFloat(colNo, floatValue) method.

The floatValue was 1.1 as I typed it in and printed out (System.out.print) but that value will be 1,10000002384186 inside the database.

That column in SQLServer is typed float

Please help..

What've I done wrong

David

[372 byte] By [Klincia] at [2007-10-2 9:09:37]
# 1

Well, for storing values EXACTLY the way you sent them to the database, float values are not a good way. Float values are not stored as a textstring or anything like that. A real number that you can type exactly on your keyboard, is not always possible to store exact in a float system. (Remember, the base is (most often) 2, not 10)

Use other ways, for example, if you want a number the exact same form as you inserted it, you can even use char-values, or different types of decimal-formats. Not sure how you do this the best way in SQL-2000.

Bebbena at 2007-7-16 23:16:35 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...