I've written a pretty lengthy migration script to move data from an old database format to a new one. I have since learned that the database names that I've written into my sql may not be the database names on d-day when we actually perform the migration.
I was wondering if it's possible to set a db name in a variable and have all of the subsequent queries refer to that variable as a db name. I tried this but it doesn't work:
SET @current_db_name='mbamdev_new';
SELECT * FROM @current_db_name.admin;
I get an 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 '@current_db_name.admin' at line 1