MySQL Decimal DataType - Truncating Insert Values With Commas?

后端 未结 1 1077
自闭症患者
自闭症患者 2021-01-27 15:45

I have a MySQL field that is of the type Decimal(12,2). Upon using the following query to get an insert, I\'m not getting the correct value stored.

INSERT INTO t         


        
相关标签:
1条回答
  • 2021-01-27 16:00

    if your value is read from some HTML form and you can't avoid the comma being sent to the query, do as follows:

    INSERT INTO table (someValue) VALUES (replace('1,200',',','');
    

    that should do....

    0 讨论(0)
提交回复
热议问题