Bahy Mohamed
Bahy Mohamed

Reputation: 311

how to create ETL to dynamically get the port name

i have a table


table:

col1,col2

1,2

3,4

i want to create ETL to extract only port/column name in another table example my target table should contain one column with 2 rows contain column names


target:

target_column

col1

col2

so how can i do that

Upvotes: 0

Views: 63

Answers (1)

Maciejg
Maciejg

Reputation: 3378

Query the metadata. Depending on the type of your DB this may differ. For MySQL that would be:

SELECT COLUMN_NAME 
FROM INFORMATION_SCHEMA.COLUMNS 
WHERE TABLE_NAME = 'your_table_name' 
AND TABLE_SCHEMA = 'your_database_name';

Here, try this fiddle.

Upvotes: 0

Related Questions