MySQL error

Hi

I want to add a new column in my table, and i’m always getting 1064 error.

Can someone tell yhat’s wrong.

SQL Query :




 ALTER TABLE `user` 

ADD `picture` VARCHAR 

NOT NULL 

AFTER `dob` 



SQL Error


#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL AFTER dob’ at line 3


thank you in advance

[color="#008000"]NOTE: moved to proper section (Miscellaneous instead of General Discussion for Yii 1.1.x)[/color]

This not really related to Yii but to MySql… So did you check the MySql syntax ?

spoiler: for varchar you need to set the length

Actually i tried with other data types, but it’s also the same.

I even tried to drop the table and created again, and it didn’t worked, so I had to restart phpmyadmin, and now everything is fine.

thank you for your quick reply

for MySQL:


ALTER TABLE `user` 

ADD COLUMN `picture` VARCHAR(255) NOT NULL 

AFTER `dob`;