clear markdown compare help best fiddles feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3601568 fiddles created (47973 in the last week).

create table mytable (ConstantValue varchar(100));
 hidden batch(es)


insert into mytable values ('1252.36'),('abc'),('55969'),('def'),('66955663'),('A8879'),('-41.25'),('+636');
 hidden batch(es)


alter table mytable add column NewConstantValue double default(0);
 hidden batch(es)


update mytable set ConstantValue = '0' where ConstantValue not regexp '^(-|\\+)?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+|[0-9]+)$';
 hidden batch(es)


update mytable set NewConstantValue = cast(ConstantValue as double);
 hidden batch(es)


select * from mytable;
ConstantValue NewConstantValue
1252.36 1252.36
0 0
55969 55969
0 0
66955663 66955663
0 0
-41.25 -41.25
+636 636
 hidden batch(es)


alter table mytable drop column ConstantValue;
 hidden batch(es)


alter table mytable change column NewConstantValue ConstantValue double default(0);
 hidden batch(es)


select * from mytable;
ConstantValue
1252.36
0
55969
0
66955663
0
-41.25
636
 hidden batch(es)