your xml sample , i guess , is not correctend tag does not match with start tag1-<event> , does not close2-<main> body </title> = <main> tag close with <title> ? those are correct?for test , I change to something like this :<event> <msg langID = "1"> <title> hello </title> <main> body </main> </msg> <msg langID = "2"> <title> hola</title> <main> body </main> </msg> </event>
here is my solutionselect xmlTable.[MsgID] as [MsgID] ,t.u.value('@langID[1]','nvarchar(30)') as [langID] ,t.u.value('title[1]' ,'nvarchar(30)') as [title] ,t.u.value('main[1]','nvarchar(30)') as [main]from xmlTable cross apply [xmlTable].Data.nodes('event/msg') as t(u)
Ce-am pe mine am si-n dulap, cand ma-mbrac zici ca ma mutsabinWeb