I have a XML column in a table that looks like this:
<word A="al" B="h" C="Ps" />
<word A="has" B="es" C="Pf" />
<word A="mom" B="es" C="Ph" />
I need to convert into table like this:
word | A | B | C
====================
al | A1 | B1 | C1
has | A2 | B2 | C2
mom | A3 | B2 | C3
I want to do by a function in SQL Server.
Thanks!
Guessing on data type here, and also guessing that you didn’t mean to convert
a1->A1, etc.Results:
EDIT
And now that you’ve completely changed the question, making my answer look insane and completely unrelated to your question, let’s try again. Once more I’m making some guesses here because you’re not describing your logic or requirements very well. Does the B column increment every time you see a new value? Same with the C column? Is there any chance there are duplicates that aren’t in consecutive rows?
Results:
If you want coherent answers that actually solve your problem, you should work on describing your problem well (and getting it right the first time, before a bunch of effort is spent trying to solve the wrong problem).