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

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

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

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -