urz shah
urz shah

Reputation: 481

Money vs. Decimal vs. Float Performance issues (SQL data types for Currency value)?

What data type should be selected in case of Currency value column in SQL server. I have read some where on web Working on customer implementations, we found some interesting performance numbers concerning the money data type. For example, when Analysis Services was set to the currency data type (from double) to match the SQL Server money data type, there was a 13% improvement in processing speed (rows/sec). Is it true??

Upvotes: 1

Views: 3662

Answers (1)

Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239664

What data type should be selected in case of Currency value column in SQL server.

I'd always go for decimal unless there was a strong reason not to. float is inappropriate since not all decimal values can be exactly represented, and you'll end up with weird artifacts (e.g. you'll have an amount of 48.15000000000000000135).

money is often inappropriate since it has a fixed precision and scale which may not match your actual requirements. And it applies rounding on each intermediate result as well as the final one, which may not be suitable for complex calculations. With decimal calculations, you have more control over when rounding will occur (by converting to a decimal with a smaller precision).

Upvotes: 6

Related Questions