I have a xml data schema like below. All I need is to read the xml data and store it in a temp table. The columns are dynamic (the columns below are samples only), but the attributes are constant. I am expecting the result below.
BandCode BandDescription BandName Code Country Currency Pay1_11 Pay1_12 Pay1_13 Pay1_14 Pay1_15
123440 Band-A Band1 1234567 Germany US 10000.00 10000.00 10000.00 10000.00 10000.00
123441 Band-B Band2 1234567 Germany US 10000.00 10000.00 10000.00 10000.00 10000.00
Sample xml data
<CookedData>
<row RowNumber="1">
<Column DestinationColumnCode="BandCode" DataType="VARCHAR(3000)" Value="123440"/>
<Column DestinationColumnCode="BandDescription" DataType="VARCHAR(3000)" Value="Band-A"/>
<Column DestinationColumnCode="BandName" DataType="VARCHAR(3000)" Value="Band1"/>
<Column DestinationColumnCode="Code" DataType="VARCHAR(3000)" Value="1234567"/>
<Column DestinationColumnCode="Country" DataType="VARCHAR(3000)" Value="Germany"/>
<Column DestinationColumnCode="Currency" DataType="MONEY" Value="US"/>
<Column DestinationColumnCode="Pay1_11" DataType="MONEY" Value="10000.00"/>
<Column DestinationColumnCode="Pay1_12" DataType="MONEY" Value="10000.00"/>
<Column DestinationColumnCode="Pay1_13" DataType="MONEY" Value="10000.00"/>
<Column DestinationColumnCode="Pay1_14" DataType="MONEY" Value="10000.00"/>
<Column DestinationColumnCode="Pay1_15" DataType="MONEY" Value="10000.00"/>
</row>
<row RowNumber="2">
<Column DestinationColumnCode="BandCode" DataType="VARCHAR(3000)" Value="123441"/>
<Column DestinationColumnCode="BandDescription" DataType="VARCHAR(3000)" Value="Band-B"/>
<Column DestinationColumnCode="BandName" DataType="VARCHAR(3000)" Value="Band2"/>
<Column DestinationColumnCode="Code" DataType="VARCHAR(3000)" Value="1234567"/>
<Column DestinationColumnCode="Country" DataType="VARCHAR(3000)" Value="Germany"/>
<Column DestinationColumnCode="Currency" DataType="MONEY" Value="US"/>
<Column DestinationColumnCode="Pay1_11" DataType="MONEY" Value="10000.00"/>
<Column DestinationColumnCode="Pay1_12" DataType="MONEY" Value="10000.00"/>
<Column DestinationColumnCode="Pay1_13" DataType="MONEY" Value="10000.00"/>
<Column DestinationColumnCode="Pay1_14" DataType="MONEY" Value="10000.00"/>
<Column DestinationColumnCode="Pay1_15" DataType="MONEY" Value="10000.00"/>
</row>
</CookedData>
I have researched on how to do this, however the sample code that I have found is for static columns only.