I have the next XML
file:
<?xml version="1.0" encoding="utf-8"?>
<DynamicEntity Name="ProductsMilk">
<Field Name="Name" Type="nvarchar(256)" AllowNulls="false" />
<Field Name="Description" Type="ntext" AllowNulls="false" />
<Field Name="Price" Type="float" AllowNulls="false" />
</DynamicEntity>
I need to read some value from any option of XML-node
, for e.g. I need to read the value of Type option from Field node using T-SQL
.
How can I do this using internal OpenXML provider in MSSQL
?
The following will extract all the data from your XML:
Basically, you just need to specify a column mapping for your xml attributes.