I am trying to do something like this, 1.get the database name (db1) and assign to a string variable 2.the data I need are in db1.out 3.get the data into a table from db1_out
set @dbname = SELECT DATABASE();
set @newdb = concat(@dbname,'_out');
drop table if exists AAA;
create AAA
Select *
from @newdb.BBB;
Can someone please help me with this?
Thank you
[0-9,a-z,A-Z$_]that validates a valid database name so you need to replace the dot with a underscore.SET @dbname = DATABASE();should work check mine answerusecommand or via parameter