I have a column of XML data type with the following contents:
<Station>
<row>
<lid>1055</lid>
<sname>some name</sname>
<sipadress>111.222.011.112</sipadress>
<sdescription>Some description</sdescription>
... many more elements ...
</row>
</Station>
I'd like to have a view or a result which looks something like that:
lid |sname |sipadress |sdescription | ...
-----------------------------------------------------
1055|some name|111.222.011.112|Some description| ...
I've searched for hours and tried sp_xml_preparedocument
, CROSS APPLY
... but for every solution, you have to specify the elements, respectively the column-names (lid, sname, sipadress...
)
I'm searching for a way to get all the descendants of <row>
, wherever the number, and without specifying the name of them and then to create columns for them.
Thanks in advance!