How to store a numeric value which can have other statuses in a database?
Posted
by Jiho Han
on Stack Overflow
See other posts from Stack Overflow
or by Jiho Han
Published on 2010-04-13T20:09:28Z
Indexed on
2010/04/13
20:12 UTC
Read the original article
Hit count: 436
I need to store a set of numbers in a database which are imported from a spreadsheet.
Sometimes a number is just a number. But in other times, a value can be "missing", "N/A", or blank and these all represent different things.
What would be a good approach to store these numbers in the database? Originally I only had to account for N/A. So I made it -1 as I imported them (this only works if the number can never be negative obviously). I could use other negative numbers for other statuses. However, that seems clunky to me.
Should I store the numbers as string then apply conversion at use time? Should I create a matching table that stores different statuses of each value?
© Stack Overflow or respective owner