SQL Server's Stupid "Decimal" DataType

Ok so, on a recent project, for some reason, I set up a few fields, and the corrosponding SP parameters as “decimal” datatypes. What a mistake.

After lots of rounding errors, which were partly ignored because the revised “specs” called for these figures to be integers (later changed to decimals), I found out that a Decimal datatype has no decimal places, unless you specifically declare it.

The reason for this is that a “decimal” is really just another name for a “numeric”. So I guess I can understand that part… but how dumb is it that a decimal, by default, has no decimal places.

I went back and changed everything to float.

Use decimal(x,x) instead of float.  See here for the reason why.

Leave a comment