Home All Groups Group Topic Archive Search About

Qty - decimal, money, or ...

Author
17 Feb 2006 9:30 AM
Rock
which data type will be the best for the qty column?

- R

Author
17 Feb 2006 9:40 AM
ML
Depends on the actual values. What kind of values do you expect?


ML

---
http://milambda.blogspot.com/
Author
17 Feb 2006 12:38 PM
Brian Selzer
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.

Show quote
"Rock" <R***@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
Author
17 Feb 2006 10:37 PM
Roy Harvey
On Fri, 17 Feb 2006 01:30:27 -0800, "Rock"
<R***@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

AddThis Social Bookmark Button