Correct SQL database data [closed]

0

I want to correct a table field, as I have values like this: 123456789 and want to change to 1234567.89

    
asked by anonymous 04.05.2016 / 15:49

3 answers

3

To put the decimal places, you only have to multiply the value by 0.01. 123456789 * 0.01 = 1234567.89

update table set coldecimal = coldecimal * 0.01

But first, change the column type.

    
05.05.2016 / 03:28
0

Run the command:

ALTER TABLE tabela MODIFY coluna DECIMAL(10, 2);
    
04.05.2016 / 16:12
0

I got the following code

update cad_recibo SET valor_recibo = REPLACE(valor_recibo, '00.00', '.00');

So if you have any cents you do not change. so I wanted some way to make the values with cents too

    
04.05.2016 / 19:40