Hi,declare @str as varchar(100)='just_test <id = 1> some_value <id = 30> a_value <id = 5>'declare @strXML as xmlset @str =replace(@str,' <id = ','|') /* get rideoff last >*/set @str = substring(@str,1,len(@str)-1) /*convert to cast .That could be done also in FROM */set @strXML=cast('<root><element>'+ replace(@str,'>','</element><element>')+'</element></root>' as XML)select SUBSTRING(t.u.value('.','varchar(100)'),1,CHARINDEX('|',t.u.value('.','varchar(100)'))-1) as [value],SUBSTRING(t.u.value('.','varchar(100)'),CHARINDEX('|',t.u.value('.','varchar(100)'))+1,len(t.u.value('.','varchar(100)'))-CHARINDEX('|',t.u.value('.','varchar(100)'))) as [id]from (select @strXML as strXML) m cross apply strXML.nodes('root/element') as t(u)
you can inspire from this:[url]http://visakhm.blogspot.in/2013/01/delimited-string-split-xml-parsing.html[/url]it's ugly , maybe someone come with something more elegant ;)SCe-am pe mine am si-n dulap, cand ma-mbrac zici ca ma mutsabinWeb