trying to query out some XML data, the data is structured like the below. (but with far more rows).
<FIELD>
<ROW>
<FIELD name="LI_PRODID">1</FIELD>
<FIELD name="LI_QTY">3</FIELD>
<FIELD name="CALC_UOM">1</FIELD>
</ROW>
<ROW>
<FIELD name="LI_PRODID">2</FIELD>
<FIELD name="LI_QTY">4</FIELD>
<FIELD name="CALC_UOM">1</FIELD>
</ROW>
</FIELD>
I have the following:
DECLARE @nameElement NVARCHAR(30) = '"LI_PROD"';
SELECT
col.value('(FIELD/ROW/FIELD[name=sql:variable("@nameElement")])[1]', 'nvarchar(30)')
FROM
Table
How would I go about actually getting each "LI_PRODID" on a different row as a column, then repeating for each of the for each row?