Monday, March 12, 2012

Qty - decimal, money, or ...

which data type will be the best for the qty column?
- RDepends on the actual values. What kind of values do you expect?
ML
http://milambda.blogspot.com/|||Precision should have been specified in a requirements document. If that's
what you're working on, then you need to consider what things are to be
quantified. Are they inventory items that are purchased and sold in
individual packages? Are they purchased or sold by weight? By volume?
Remember that if you use a float data type that you must account for
rounding errors in calculations, which usually involves adding additional
code and invites the possibility that a programmer will fail to add that
code.
"Rock" <Rock@.discussions.microsoft.com> wrote in message
news:3F994D97-A01B-48B2-B555-510FF25A9DF2@.microsoft.com...
> which data type will be the best for the qty column?
> - R|||On Fri, 17 Feb 2006 01:30:27 -0800, "Rock"
<Rock@.discussions.microsoft.com> wrote:

>which data type will be the best for the qty column?
>- R
If it is always a whole number 3, 1534, 65432, then I use the
appropriately sized version of Int (generally int, possibly bigint).
If it is a decimal fraction of known size, say 145.75 I would use
Decimal.
If it is a decimal fraction that has to be more flexible, then float
may be required, but take Brian's warning to heart if you go that way.
Roy

No comments:

Post a Comment