0

Hi,

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

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by almostbob
0

Hi,

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)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.