I am setting a variable, and then I want to use the USE
command to change the database. Unfortunately USE
doesn't evaluate the variable.
SET @con="testDB";
Query OK, 0 rows affected (0.00 sec)
select @con;
+--------+
| @con |
+--------+
| testDB |
+--------+
1 row in set (0.00 sec)
use @con;
ERROR 1049 (42000): Unknown database '@con'
So the value of the variable is not evaluated when I try to connect. Any ideas?