Combine Rows with FOR XML PATH

Who is online?  0 guests and 1 members
Home  »  Blogs  »  timmurphy  »  Combine Rows with FOR XML PATH
 
0
/5
Avg: 0/5: (0 votes)

Comments (4)

drmcclelland
drmcclelland said:

You blogged this today, and I needed it today!  Great timing!

12/22/2010
 · 
 
by
timmurphy
timmurphy said:

Glad you could use it, David.

12/22/2010
 · 
 
by
chhapia_chintak

Hi,

This can create a problem when there are some HTMP markup chars in string column.

If we do it this way we can avoide the problem of HTML markup chars.

 

SELECT t1.TextFamily AS TextFamily

      ,(SELECT RTRIM(t2.TextLine)  + ' '

          FROM TextTable t2

             WHERE t1.TextFamily = t2.TextFamily

                ORDER BY TextGroup, TextSequence

        FOR XML PATH(''),type).value('.','nvarchar(max)') AS FamilyTextDescription

FROM TextTable t1

GROUP BY TextFamily

- Chintak

12/22/2010
 · 
 
by
timmurphy
timmurphy said:

Thanks for pointing that out Chintak.

1/1/2011
 · 
 
by
Blogs RSS Feed

timmurphy's latest blog posts

Blogs RSS Feed

Latest community blog posts