Reputation: 1011
I have the field field_name
with the following type DECIMAL (10, 2)
. I want to insert a floating-point number in this field. I have the following SQL-query:
UPDATE `table_name` SET `field_name` = "0,20" WHERE `primary_key` = 1;
SELECT `field_name` FROM `table_name` WHERE `primary_key` = 1;
>> 0.00
How do I write a floating-point number?
Upvotes: 1
Views: 13440
Reputation: 77866
Try this:
UPDATE `table_name` SET `field_name` = 0.20 WHERE `primary_key` = 1;
Upvotes: 1
Reputation: 125855
Use a decimal point .
instead of a comma ,
:
UPDATE table_name SET field_name = 0.20 WHERE primary_key = 1
However, do note that the DECIMAL
type is fixed-point, not floating-point.
Upvotes: 2
Reputation: 204756
UPDATE `table_name`
SET `field_name` = 0.20
WHERE `primary_key` = 1;
It is called floating-point-number - so use a point instead of comma. And since it is no string you don't need the quotes around it.
Upvotes: 0