Gossamer Forum
Home : General : Databases and SQL :

Price (money) field

Quote Reply
Price (money) field
Which type should I use for storing prices (money)?

FLOAT, DECIMAL ... or something else?

Format is 0.00



Thanks
Quote Reply
Re: [Payooo] Price (money) field In reply to
You should use decimal

Last edited by:

Paul: May 15, 2003, 2:41 AM
Quote Reply
Re: [Paul] Price (money) field In reply to
Thanks Paul.

Similar post:

http://www.gossamer-threads.com/...orum.cgi?post=203942

But, I don't understand "precision" and "decimal" part of it.

Maybe Length/Set = 12,2 ?
Quote Reply
Re: [Payooo] Price (money) field In reply to
According to the manual, precision is the number of digits (how wide the field is) and the decimal is how many to the right of the decimal point.

(12,2) would be:

1234567890.12

In it's "best" case. Negative numbers, will be one place shorter, as will some flavors of Unix or other OS's that count the '.' as a place (user reported quirks).

If you want to handle numbers such as 123,456,789.00 you'd be better off defining a field as (13,2) to handle that.


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [Payooo] Price (money) field In reply to
I've put this in the SQL forum as I think it's more suited there.
Quote Reply
Re: [pugdog] Price (money) field In reply to
Thanks for the explanation Smile
Quote Reply
Re: [Paul] Price (money) field In reply to
In Reply To:
I've put this in the SQL forum as I think it's more suited there.


And now it's back Crazy

Just noticed that (post above)

Something is wrong with the forum because I am 100% sure that I posted this thread in the right forum (I know because I still have old window open and it shows Home: Products: Links SQL: Discussions:
Price (money) field Unsure



Or, maybe I'll just go to sleep!

Last edited by:

Payooo: May 15, 2003, 6:23 AM
Quote Reply
Re: [Payooo] Price (money) field In reply to
Quote:
And now it's back

Back where?

Quote:
Something is wrong with the forum because I am 100% sure that I posted this thread in the right forum

Which forum did you post in originally?
Quote Reply
Re: [Paul] Price (money) field In reply to
Nevermind Crazy

Sorry!
Quote Reply
Re: [pugdog] Price (money) field In reply to
Back to the original topic.



When I go to MySQLMan > Add Fields and select
DECIMAL for Type field and 12,2 for Length/Set
everything is OK until I hit Resync Database.

DECIMAL changes to FLOAT.

Is this the way it is supposed to work or ...?
Quote Reply
Re: [Payooo] Price (money) field In reply to
Anybody?