mysql - How to use String variable value in 'create table' statement? -


this question has answer here:

i have stored procedure in create new tables table_name being variable. though

select table_name;

returns variable value

create table table_name(some_columns);

creates table name table_name , not value.

you need execute prepared statement:

set @sql = concat('create table ', table_name, ' (some_columns);'; prepare stmt @sql; execute stmt; 

Comments

Popular posts from this blog

double exclamation marks in haskell -

qml - Is it possible to implement SystemTrayIcon functionality in Qt Quick application -

Qt Creator - Searching files with Locator including folder -