user2251674
user2251674

Reputation: 23

Change variable type mysql with existing data

Hi I've got a variable 'text' within my MYSQL database that gathers something like a status update. I believe this variable has a limit of 200?

Upvotes: 2

Views: 2276

Answers (2)

Brian Holt
Brian Holt

Reputation: 1

Change doesn't work for us, we needed to use Modify:

ALTER TABLE `tablename` MODIFY `colname` VARCHAR( 1500 );

Upvotes: 0

Jarod
Jarod

Reputation: 1712

http://dev.mysql.com/doc/refman/5.6/en/string-type-overview.html

VARCHAR

A variable-length string. M represents the maximum column length in characters. The range of M is 0 to 65,535.

TEXT

A TEXT column with a maximum length of 65,535 (216 – 1) characters.

I thinking both VARCHAR(1500) and TEXT(1500) is ok for you.

How do i change it within phpmyadmin to the desired new variable if data is currently present within the present form?

To change data type of a column, I would just use SQL, this work in any tools.

ALTER TABLE  `tablename` CHANGE  `colname` VARCHAR( 1500 );

Upvotes: 1

Related Questions