MySQL Forums
Forum List  »  Newbie

Re: How can I create a table with variable table names
Posted by: Peter Brawley
Date: March 16, 2020 11:46AM

SQL can't read our minds, we need to tell it to concatenate the strings ...

SET @table = 't3';
SET @s = CONCAT('CREATE TABLE ',@table, '(a INT not null)');
...

Options: ReplyQuote


Subject
Written By
Posted
Re: How can I create a table with variable table names
March 16, 2020 11:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.