Reputation: 115
My table name that I am pulling the column names from is dbcrms.sourcedata
. I am trying to pull all the column names and insert them into a table called data_columns
. How would I do so? Thanks!
Upvotes: 2
Views: 60
Reputation: 21312
Not really knowing your full table schema here is an example of what you can do using information_schema:
INSERT INTO data_columns (column_name)
SELECT column_name FROM information_schema.`COLUMNS` WHERE TABLE_NAME = 'sourcedata' AND TABLE_SCHEMA = 'dbcrms';
Upvotes: 3