测试.sql:
SET @my_var = 50;
CREATE TABLE test_table (
id SMALLINT NOT NULL,
my_text VARCHAR(@my_var),
PRIMARY KEY (id)
);
命令行交互:
mysql> source d:/test.sql;
Query OK, 0 rows affected (0.00 sec)
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
'@my_var),
PRIMARY KEY (id)
)' at line 3
有没有办法做到这一点?