sql - Transpose comma seperated data into rows - some clarification -


let have data

id   string ------------------- 1       john, adam 

based on below query transpose comma seperated data rows

 select a.[id],        split.a.value('.', 'varchar(100)') string     (select [id],            cast ('<m>' + replace([string], ',', '</m><m>') + '</m>' xml) string         tablea) cross apply string.nodes ('/m') split(a); 

now, know reason have '.' , <m> in our query?

pn: instead of flagging post please let me know delete post if should not post.

if print out string within cast, see text string has been turned xml string. '.' in split command merely location in start parsing xml.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -