Change data type varchar to int

Asked

Viewed 673 times

0

Is there a problem changing the data type from varchar to int in mysql? I have a spreadsheet with some items that were inserted as varchar, all are numbers. The problem is that I need to do a search for bigger and smaller, however, as it is in varchar I do not know if it works. Also, I’m afraid of changing the type and having loss in the data.

  • If you do everything correctly you need not be afraid, just keep the varchar field and create a new one with int

  • da to use the CAST function or run a script in PHP, Java, or another language to insert into the new field

  • You can try the CONVERT

  • as @Sveen said, I didn’t need anything, just update the field. All data maintained.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.