I have a script that I run on multiple databases and to run on multiple databases I just change the MySql “USE” statement.
I’m wanting to have a select statement that outputs the current database the script is executing against as a field.
For example:
USE my_db;
SELECT
CURRENT_DB, -- this is where to insert the current executing db, i.e. "my_db"
id, name, blah, blah
FROM my_table
Use the
database()function:http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_database