Friday, March 9, 2012

Decimal vs currency....

It seems that the "decimal" type allows more flexibility but also uses more storage than "money". On the other hand, does "money" have any special t-sql functions that understand its unquie nature? (e.g. adding two money values together with no cents round-off error).

For example, would the number 12345.12 be declared as a decimal(7,2) or currency?

Barkingdog

There aren't any special functions that explicitly recognize a monetary data type. How you declare it really depends upon what you are storing in there. If I'm storing pricing or something else that is in monetary units, I use money. If I'm doing complex financial caculations, I use decimal, because the money data type is accurate to 4 decimal places and for calculating a lot of financial stuff, you need better accuracy than that.

No comments:

Post a Comment