This is a little convoluted but works:declare @a table (i int not null identity(1,1), data varchar(1024), dom as replace(substring(data,charindex(')',data,charindex('(',data))+1,len(data)),'(0)','')) --computed column removes unneeded datainsert @a(data) select '20100717 22:20:37 928 PACKET 01943580 UDP Rcv 10.16.68.133 a6c1 Q [0001 D NOERROR] SOA (12)ServiceLT114(5)tserv(4)domain(3)com(0)' union allselect '20100717 22:20:37 928 PACKET 01943580 UDP Snd 10.16.68.133 a6c1 R Q [8085 A DR NOERROR] SOA (12)ServiceLT114(5)tserv(4)domain(3)com(0)' union allselect '20100717 22:20:39 928 PACKET 01944030 UDP Rcv 10.16.71.217 b93c Q [0001 D NOERROR] A (9)HVProfile(5)tserv(4)domain(3)com(0)';with a(a,i) as (select ')'+dom+'(', i from @a), --add parens to simplify parsingn(n) as (select 1 union all select n+1 from n where n<1024) --number generator for substringselect i, stuff((select '.'+substring(a,n,charindex('(',a,n)-n) from a cross join n where substring(a,n-1,1)=')' and a.i=b.i --need to "join" row ID/primary key order by i, n for xml path('')),1,1,'') --this will concatenate rowsfrom a boption (maxrecursion 1024)
You'll have to modify this for your structure, and you'll need a column that uniquely identifies the row in a join (see comment above)