swapnesh
swapnesh

Reputation: 26722

Table Data Type Alter

I created a table named items and inserted name as int and provided the length as 255 type by mistake but now i wanted to alter the table structure and run the query as--

ALTER TABLE items ALTER COLUMN name varchar(255); but it is not altering the table what i need to change in the table.help plz

Upvotes: 3

Views: 33177

Answers (3)

royrui
royrui

Reputation: 1207

Try:

ALTER table items
MODIFY name varchar(255);

Upvotes: 1

xkeshav
xkeshav

Reputation: 54016

there are two ways

ALTER TABLE t1 CHANGE <column_name> <column_name> <type> 

note: you have to write column name twice OR

ALTER TABLE t1 MODIFY <column_name> <type> ;

Reference

Upvotes: 22

Neo
Neo

Reputation: 5463

try:

alter table t1 modify column name varchar(255);

Upvotes: 2

Related Questions