且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在MySql中将VARCHAR转换为DECIMAL值

更新时间:2023-01-23 08:53:07

我认为,如果您对MySQL具有管理员权限,则需要尝试在MySQL上执行类似的操作.

I think you need to try doing something like this on your MySQL if you have admin privilege on your MySQL.

ALTER TABLE表名修改列名DECIMAL(M,D)

ALTER TABLE tablename MODIFY columnname DECIMAL(M,D)

有关M,D变量,请阅读此内容- http://dev.mysql.com/doc/refman/5.0/zh-CN/fixed-point-types.html

for the M,D variables, read this - http://dev.mysql.com/doc/refman/5.0/en/fixed-point-types.html

MySQL应该能够自动将文本转换为数字.只是MySQL中的数据类型可能不是十进制,这就是为什么不能存储任何十进制的原因.

And MySQL should be able to automatically converting a text to a numeric. Just that the data type in MySQL might not be a decimal yet that's why you can't store any decimal.