Reputation: 481
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
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