MariaDB 将列类型 varchar 转换为 int

MariaDB convert column type varchar to int

列的经度值的形式为 (+ or -) 36:12:20:0654。我想将它们更改为 (+ or -) 36.12200654。我怎么做? 我试过这个命令:

alter table_name alter column column_name int;

但它将值更改为 36 且没有符号。

我并不为我想出的复杂性感到骄傲,但它确实有效:

alter table table_name add column temp double;
update table_name set temp = concat(substr(column_name, 1, position(':' in column_name) - 1), '.', replace(substr(column_name, position(':' in column_name)), ':', ''));
alter table table_name drop column column_name;
alter table table_name change column temp column_name double; 

更新:根据评论中值的新格式,更新应如下所示:

update table_name set temp = concat(substr(column_name, 1, position(':' in column_name) - 1), '.', replace(replace(substr(column_name, position(':' in column_name)), ':', ''), '.', ''))