sql-servertypessqldatatypes

Appropriate datatype for holding percent values?


What is the best datatype for holding percent values ranging from 0.00% to 100.00%?


Solution

  • Assuming two decimal places on your percentages, the data type you use depends on how you plan to store your percentages:

    Combined with a good column name, it makes it clear to other developers what the data is and how the data is stored in the column.

    Edit: Per modern conventions, we don't name columns indicating the type since the type may change one day and we use contracts and versions to make that indication. Hungarian naming had it's day, and we've moved on to better practices.