Add Letter in a field with 20000 lines

0

I have a produto table filled with 20000 products and I need to add a o in the first character of the codigo field of all rows.

How can I do this with MySQL?

    
asked by anonymous 07.04.2015 / 12:07

1 answer

3

Considering that the column is text type, and that this change will not cause harmful side effects (such as breaking foreign keys), the command is simple:

UPDATE produto
SET codigo = CONCAT('o', codigo);

As in the question there are the unknowns I mentioned above, I recommend backing up the database before doing this.

    
07.04.2015 / 13:04