how to create ETL to dynamically get the port name

35 Views Asked by At

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

1

There are 1 best solutions below

0
Maciejg On

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.