I have a staging table like below that i load csv files into with headers:
column1 | column2 | column3 | column4 |
---|---|---|---|
filetype | source | fund | city |
Second | row | row | row |
As you can see, the columns are not defined as actual column names bcz my files have different formats everytime so i just load the files as is with the headers into the table.
Now i want to create a metadata table which contains details like below:
stg_column | tgt_column | filetype |
---|---|---|
column1 | filetype | A |
column2 | source | B |
column3 | fund | C |
column4 | city | D |
I want to do the above everytime i load a file into the staging table. could you please help me write a query or proc to do the same?
Thank you in Advance.