I'd like to number the rows created by using cross apply. Lets say I have a table like this
key|value
---+-----
1 | A
2 | B
and I run
select * from t CROSS apply String_Split('x,y', ',')
Id like to get that result:
key|value|value|number
---+-----+-----+--------
1 | A | x | 1
1 | A | y | 2
2 | B | x | 1
2 | B | y | 2
But I have no idead how to achive this; Also the "number" should be resitant to ordering. Any Hints? Suggestions?
Thanks!