简体   繁体   中英

Why this is not valid MySQL query?

mysql> ALTER TABLE bdds_arts ADD test VARBINARY;

ERROR 1064 (42000): 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 
'' at line 1

something wrong with varbinary type?

here is output of mysql --version

mysql  Ver 14.12 Distrib 5.0.24a, for Win32 (ia32)

UPDATE If I change VARBINARY for BINARY or, say, VARBINARY(25) it works.

Since this is piece of auto-generated script in order to fix this I should know what is going on.

The BINARY and VARBINARY types are similar to CHAR and VARCHAR.

You have to use a length for it like Varchar(255)

删除bdds_arts之后的逗号。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM