Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Need to Merge text in a cell Expand / Collapse
Posted Tuesday, December 24, 2013 12:15 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, May 8, 2014 10:30 PM
Points: 32, Visits: 113
HI ,

If i have a value as AAA,AAA,AAA,AAA,BBB,CCC
Then i want return it as AAA,BBB,CCC. Can Anyone please suggest whether this is possible.

Thanks in Advance
Post #1525693
Posted Wednesday, December 25, 2013 5:49 AM


Group: General Forum Members
Last Login: Monday, September 8, 2014 7:34 AM
Points: 14, Visits: 21
Hi, or or
Post #1525885
Posted Saturday, December 28, 2013 5:27 AM



Group: General Forum Members
Last Login: Monday, July 13, 2015 10:29 AM
Points: 6,897, Visits: 13,551
You could split the string using the Delimited Split Function refernced in my signature and the "FOR XML PATH" approach together with a DISTINCT to build te final string.
If the length of each element is known and constant, the split function can be simplified.

A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #1526288
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse