I am wondering how to split and parse long XML values into one row. I have seen some options on this site for splitting via ',' but that won't work for me, since there are no commas in my field. For reference the data would look something like:
[XMLColumn]
<Student><Id>uniqueidentifier</Id><Name>Chris</Name><Grade>11</Grade></Student><Student><Id>uniqueidentifier</Id><Name>Joe</Name><Grade>4</Grade></Student><Student><Id>uniqueidentifier</Id><Name>Alex</Name><Grade>9</Grade></Student><Student><Id>uniqueidentifier</Id><Name>Mary</Name><Grade>2</Grade></Student>
I would like to split on each Student tag (<Student></Student>)
So it might look something like:
Id Name Grade
uniqueidentifier Chris 11
uniqueidentifier Joe 4
uniqueidentifier Alex 9
uniqueidentifier Mary 2
Also ideally, I do not want to use a function unless it's of a low complexity. I am just doing experiments on existing school projects that I have done and seeing if there are ways to make my queries faster.
The problem is, although I will always know the properties for a Student (Id, Name, and Grade)
, the data inside will always be of different length, so even splitting at a certain index won't necessarily work. If anyone could help, that'd be great.