I am creating database at runtime and I want to create the tables in that database at the same time. Can anyone give me any thought on how to do that?
For Example –
I have created one database named ‘mydb’
and now in the same process I am trying to create the table I am using the mysql stored procedure for the same.
My proc input will be my dbname. So, my proc looks like
create procedure test(IN dbname varchar(100))
begin
create table `dbname`.`testing`(testid int, testname varchar(45));
end
You can use the PREPARE feature to execute dynamic SQL.