How to change the datatype of a column from text to int in MySQL Workbench?

Viewed 26

I tried to change the datatype of the 'total' column from 'text' to 'int' by using the following query down below:

alter table sales
modify column total int;

but it fails due to:

Error Code: 1366. Incorrect integer value: '' for column 'total' at row 943

I have checked that specific record and it contains either null or simply a space.

Therefore how to modify the column datatype from text to int if the columns contains a space?

0 Answers
Related