MySQL Forums
Forum List  »  General

data from SHOW COLUMNS
Posted by: Marty -
Date: July 27, 2008 05:48AM

I'm solving such a nuisance but I really want to know how to accomplish it. I would like to read columns of one table named "companies" (I don't know about any other way than with SHOW COLUMNS) and insert these names of fields as records to another table named "system"

I have ended up with this SQL (not functional):

SET @read_table = 'companies';
/* ========================= */
INSERT INTO system (`table`, `field`)
SELECT @read_table as `table`, field
FROM (SHOW COLUMNS FROM `@read_table`) as tbl

Thanks for any suggestion!

Options: ReplyQuote


Subject
Written By
Posted
data from SHOW COLUMNS
July 27, 2008 05:48AM
July 27, 2008 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.