I need to be able to store numbers like 3.5 in my table. So I've used the decimal type field. But if I enter 3.5 it round it up to 4. Am I being stupid or is it not the point of decimal to have a decimal point?
-
Why you do not use FLOAT, And if You need to round always numbers to 0.0 or 0.5 take look at this threadadopilot– adopilot2010-04-06 08:30:37 +00:00Commented Apr 6, 2010 at 8:30
-
yup that worked, I just though FLOAT was for massive numbers. Thinks I need to get my head around data types again. thanks adopilot!iamjonesy– iamjonesy2010-04-06 08:34:36 +00:00Commented Apr 6, 2010 at 8:34
-
@Jonesy - just make sure you understand the difference between FLOATs and DECIMALs as they are not the same. FLOAT is approximate: msdn.microsoft.com/en-us/library/ms173773.aspx vs DECIMAL reference: msdn.microsoft.com/en-us/library/ms187746.aspxAdaTheDev– AdaTheDev2010-04-06 08:39:28 +00:00Commented Apr 6, 2010 at 8:39
-
2Can you post the full definition of the decimal column (i.e. the scale and precision you've used) e.g. DECIMAL(10, 2) - 10=precision, 2=scale. Also, how are you entering the number - into a UI? In an SQL statement? Could you post that up too?AdaTheDev– AdaTheDev2010-04-06 08:41:25 +00:00Commented Apr 6, 2010 at 8:41
-
1Float is a very bad idea if you plan to do math onthe value. It will cause rounding errors as it is not an exact value. Very bad recommendation.HLGEM– HLGEM2010-04-06 14:06:59 +00:00Commented Apr 6, 2010 at 14:06
Add a comment
|