Change column name in MariaDB

eco picture eco · Feb 13, 2015 · Viewed 14.2k times · Source

I have this column in this database with a spacebar included, which I want to change.

ALTER TABLE . CHANGE COLUMN `Anzahl Personen` AnzahlPersonen int(11); 

After using this line in the command line the output is as following:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHANGE COLUMN `Anzahl Personen` AnzahlPersonen int(11)' at line 1

Yeah, I have no Idea, what I am doing wrong.

Answer

taliezin picture taliezin · Feb 13, 2015

If you are using dot (.) instead of table name that is why you have error. You have to specify table name:

ALTER TABLE `table_name` CHANGE COLUMN `Anzahl Personen` AnzahlPersonen int(11);