943,906 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Marked Solved
  • Views: 1680
  • MySQL RSS
Mar 5th, 2009
0

Decimal problem

Expand Post »
Hi,
MySQL Syntax (Toggle Plain Text)
  1. INSERT INTO money (salary) VALUES ('100,000,000.00')

100,000,000.00 is stored as 100.00 in decimal (14,2).
I don't know what is wrong?

Thanks
Similar Threads
Reputation Points: 38
Solved Threads: 0
Master Poster
veledrom is offline Offline
724 posts
since Apr 2008
Mar 5th, 2009
0

Re: Decimal problem

Click to Expand / Collapse  Quote originally posted by veledrom ...
Hi,
MySQL Syntax (Toggle Plain Text)
  1. INSERT INTO money (salary) VALUES ('100,000,000.00')

100,000,000.00 is stored as 100.00 in decimal (14,2).
I don't know what is wrong?

Thanks
do not punctuate numbers in input data
mysql suypports multiple data schema, language-specific and region specific
in many supported schema the comma is a decimal separator, the number is truncated 2 digits after the first valid decimal separator = 100.00
database code is meant to be machine readable, not human readable, so dont try to make it pretty in the database
do any formatting only on output.
number should be 100000000.00.
input validation should strip out any incorrect characters in the input data, and return to the input form for re-entry with a "did you mean" prompt (like google when you mis-spell)
without validation the database wont last very long till it falls over dead
(Likewise repair dates that these salaries refer to, store timestamps not text strings, for the same reasons)
Last edited by almostbob; Mar 5th, 2009 at 10:47 am.
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009
Mar 5th, 2009
0

Re: Decimal problem

Understood. Thanks. It works now.
Reputation Points: 38
Solved Threads: 0
Master Poster
veledrom is offline Offline
724 posts
since Apr 2008
Mar 5th, 2009
0

Re: Decimal problem

Y'welcome
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: Joe 'Zonker' Brockmeier Fights FOSS License FUD
Next Thread in MySQL Forum Timeline: MYSQL Replace Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC