How would you change a column from VARCHAR(10) to VARCHAR(50)?

You need to alter the table.

Please read more here and here.

ALTER TABLE table1_name MODIFY field_name VARCHAR(50) NOT NULL;
ALTER TABLE table_name CHANGE `field` `field` VARCHAR( 50 ) NOT NULL

Hope it's clear...

PS-If your problem is solved mark the thread as solved....

You can also use CAST Command

CAST(fieldname as VARCHAR[50])

But this is more useful in using the field as a temporary basis. Like

SELECT CAST(fieldname as VARCHAR[50]) from table_name

For Permanent change using the above solution is better. (ALTER TABLE)

Peace.

commented: wrong answer. -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.