TheKidsWantDjent
TheKidsWantDjent

Reputation: 1269

Error when trying to modify column data type in MYSQL

I'm trying to change the datatype of a column of one of my tables from TEXT to VARCHAR in my database. I use this simple query which seems correct to me:

ALTER TABLE my_database.my_table MODIFY `SalesRank` VARCHAR;

However I get the error: '' () is not valid input at this position.

What is wrong with my query? The column itself is completely empty. I'm using MYSQL Workbench.

Upvotes: 0

Views: 2049

Answers (1)

Sagar Gangwal
Sagar Gangwal

Reputation: 7965

ALTER TABLE my_database.my_table MODIFY `SalesRank` VARCHAR(255);

You missed size of that column. Just try above code.

Hope this will helps you

Upvotes: 3

Related Questions