Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySql, is there a way to convert Integer field into Varchar without losing data?

I would like to change a table's schema so that one Integer field changes to Varchar one, but keep the data (previous numbers will now be strings).

like image 945
Marcin Krzysiak Avatar asked Dec 13 '12 07:12

Marcin Krzysiak


Video Answer


1 Answers

try this to alter the schema:

alter table table_name change col_name col_name varchar(10)
like image 106
Julien May Avatar answered Sep 27 '22 20:09

Julien May