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

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -