Click here to monitor SSC
SQLServerCentral is supported by Redgate
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, February 1, 2016 1:31 AM
Points: 14, Visits: 23
Hi, or or
Post #1525885
Posted Saturday, December 28, 2013 5:27 AM



Group: General Forum Members
Last Login: Wednesday, February 10, 2016 11:50 AM
Points: 6,897, Visits: 13,559
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