SQL: What do you use to store a ratio (percentage) in a database


Should I use decimal or float to store a ratio in a database? Particularly in SQL2005.

Best Solution

That depends on what your need for accuracy is. If you can tolerate the typical errors that come from the IEEE method of storing floating point numbers, then use a float, otherwise, use a decimal if you need an exact representation (and that goes for any numbers that are not integers that you will use in calculations using the percentage as well).